Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5904 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

ผู้เขียน

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')

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:

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 !

 

อวตาร
ละทิ้ง