1
votes

Is there a way to export the products to a csv file using a scheduler? I tried the csv python package discussed in this link: ( The best way to export openerp data to csv file using python ) but it seems I miss something.

I take advantage of the export_data as stated and I point my scheduler to that method but when I run it, nothing happen so I don't know if it runs or not but the scheduler keeps running.

Thanks for replies.

1
Please add more detail to your question. What went wrong when you tried using the csv package? Error messages and code snippets help us understand what is happening.Don Kirkby
I have a module that exports data to csv using scheduler. I cant give you the module as it is done for my company. So please mail to anoop@zbeanztech.com/omalbastin@zbeanztech.com. If you are creating module yourself we the Stack Overflow can help youOmaL
@Mhel: Can you provide your scheduler function code here. I guess you making small mistake only. Steps should be call export_data then open some new csv file using csv writer fill the export_data fuction values in new file,ifixthat

1 Answers

0
votes

I'm not an OpenERP (or Odoo) expert. With my current knowledge of Odoo I would get this started through ERPpeek along the lines of

erppeek [YOUR OPENERP DETAILS]
>>> l = model('product.product').browse([])
>>> import csv
>>> with open('test.csv', 'w') as fp:
    a = csv.writer(fp, delimiter=',')
    for prod in l: a.writerow(prod.read().values())

I'd further build it out into a script and then put the script in cron.

There are probably better, more standard Odoo-ish ways though.