Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Change invoice pdf file name

By
Jihen BEN ALI
on 7/30/15, 4:52 AM 732 views

Hi everyone,

I want to change the name ot the invoice pdf file by creating a new module any instruction how I do this??

Thanks

0

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 7/30/15, 5:13 AM


Dear Jihen BEN ALI,

yes you can give 'name': 'Invoice -'+'('+'Invoice number' + ')' in return from wizard to print report.

for example: this is function is call from print button in wizard.

def custom_invoice_print(self, cr, uid, ids, context=None):

self.write(cr, uid, ids, {'sent': True}, context=context)

data = self.read(cr, uid, ids)[0]

self_browse = self.browse(cr, uid, ids)

datas = {

'ids': ids,

'model': 'account.invoice',

'form': self.read(cr, uid, ids[0], context=context)

}

return {

'type': 'ir.actions.report.xml',

'report_name': 'account.invoice2',

'datas': datas,

'name': 'Invoice- ' + '(' + self_browse[0].number + ')' ,

'nodestroy' : True

}

Result: Invoice- (INV14-09_018).pdf


Updated answer:


<report auto="False" id="sale.report_sale_order" model="sale.order" name="sale.order"

rml="sale/report/sale_order.rml" string="write file name which you want to display"

usage="default"/>

Hope this helpfully

Regards,

Ankit H Gandhi.

Do you mean that in my new module I have to create a wizard ???

Jihen BEN ALI
on 7/30/15, 5:23 AM

@ Jihen no need to create wizard if you have already report then you need override the report tag see my updated answer

Ankit H Gandhi(AHG)
on 8/2/15, 7:02 AM

Thank you for your answer but it doesn't work

Jihen BEN ALI
on 8/3/15, 5:09 AM

Nothing come on when I update the module all is working good but after creating a new invoice and printing it I still getting the default name nothing change

Jihen BEN ALI
on 8/4/15, 2:42 AM

Yes please Could you give me your mail address

Jihen BEN ALI
on 8/4/15, 2:54 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/30/15, 4:52 AM
Seen: 732 times
Last updated: 8/2/15, 6:59 AM