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.

0

How to extend the limit to 128 characters in the field "Save as Attachment Prefix" for Reports/Invoice pdf

By
Michel Hugues
on 9/12/14, 5:57 AM 968 views

In "Settings/Technical/Actions/Reports"

Select an Edit Invoices pdf, the field "Save as Attachment Prefix" is limited to 128 characters !
How to extend it?

 

Rem: i use OpenErp version 7.0-20140804-231303

2

Temur

--Temur--
2894
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 9/12/14, 7:37 AM

hello,

A fast way:

1) find a file:

addons/base/ir/ir_actions.py

2) in this file find the line, which is starts with:

        'attachment': fields.char('Save as Attachment Prefix', size=128, help='This is the filename of the attachment used to ...

3) in that line, change size=128 to greather value you like, lets say: size=256, . then save and close the file.

4) restart openerp

5) in openerp, go to: "Settings/Modules/Installed Modules" page. find there module named "Base" and open it. When you open it, you'll see two buttons: "Upgrade" and "Uninstall". clikc on "Upgrade", then wait to upgrade process to be completed.

That's all, you're done. 

However, this changes may be lost upon openerp update. the better way is to develop separated module for this purpose, inherit 'ir.actions.report.xml' class in it and override 'attachment' field thereby setting preferred size. and then install that module, instead of changing code in base module.

regards,

 

Also take in account that file name lengths are limited. please read "How long a file name can be?" section at: http://windows.microsoft.com/en-us/windows/file-names-extensions-faq

Temur
on 9/12/14, 7:59 AM

Thank you for your help, but mismatch ... The field is not a file name, it is an pyhon expression like this: (object.type in ('out_invoice','out_refund')) and (object.state in ('open','paid')) and ((object.number or '').replace('/','')+'.pdf')

Michel Hugues
on 9/12/14, 9:14 AM

Yes I see. Thanks for the note. As help statement says "This is the filename of ..." I thought it's just a file name. I have not gone too far into the details.

Temur
on 9/12/14, 9:37 AM
1
Michel Hugues
On 9/12/14, 9:08 AM

@Temur:

Your answer is very comprehensive.
I understand the method, I tested and it works.
I could not find alone. I also learned other things using the debug mode. Thank you very much !

 

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: 9/12/14, 5:57 AM
Seen: 968 times
Last updated: 3/16/15, 8:10 AM