On 2015-06-16 03:24, TPH wrote:
> 
> 
> Am Montag, 15. Juni 2015 13:35:04 UTC+2 schrieb Antonio Roncero:
> >
> > Hi,
> >
> > i want to write a report from proteus. I use the code below
> >
> >     def download_invoice(invoice_id):
> >         report=Report('account.invoice')
> >         Invoice = Model.get('account.invoice')
> >         invoices = Invoice.find(condition=['id','=',invoice_id])
> >         type_, data, print_, name = report.execute(invoices, {})
> >         target = open(name+'.odt', 'w')
> >         newFileByteArray = bytearray(data)
> >         target.write(newFileByteArray)
> >         
> >
> > The file 'Invoice - FV0005.odt' is created fine but is emty. What is the 
> > correct way to do it?
> >
> > Thanks
> >
>  
> 
> 
> If the invoice is already created I only save the 
> "invoice.invoice_report_cache.data"
> 
>         f = codecs.open(filename, 'wb')
>         f.write(invoice.invoice_report_cache.data)
>         f.close()

The code of InvoiceReport does already that.


-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Reply via email to