Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Not sure on where to start reading about modifying how invoices look. This is my first try with openerp so I don't really know much on how things work. So far I read about the openoffice and sxw files and the webkit html to pdf. Not sure which one works for v7 and how and where to start. I looked at the sxw file of my fresh install but it doesn't really look like invoice that was generated. Can someone point me in the right direction?
Here is how you can use the report designer, which is a module in OpenERP that allows you to change the look of most documents:
The invoices is actually two parts.
- The company Header/Footer
- The invoice content.
Although you can edit the sxw files directly on the file system, we will may end up with different report formats as we move forward supporting different systems. So database config does win to some degree here.
To edit the company Header/Footer I just edited the RML in Settings >> Companies >> <company> >>  >> Header/Footer.
To edit the content, I installed the OpenOffice Report Designer (base_report_designer). This give you an add-on to install for OpenOffice (I use LibreOffice 18.104.22.168 on Ubuntu 12.10) to connect to the database and you can then "Modify An Existing Report". Make your changes and "Send To Server".
I've found that sometimes I can then print an invoice within OpenERP and the changes are visible, other times I have to "Conversion Brackets >> Fields" and then "Conversion Fields >> Brackets" before "Send To Server".
The RML itself lives in ir_act_report_xml.report_rml_content_data.
I'm a bit further down the same road. I got as far as generating a new account_print_invoice.rml, and seeing the change I made appear in the invoice pdf.
Unfortunately there are some screw ups. Below I describe how I deal with them.
Here's the steps I follow :
1) back up the two files. Eg,
cd $OPENERP_PATH/openerp/addons/account/report mv account_print_invoice.sxw account_print_invoice.sxw.orig mv account_print_invoice.rml account_print_invoice.rml.orig
2) pull the sxw file to my desktop with :
scp $ME@$REMOTE_HOST:$OPENERP_PATH/openerp/addons/account/report/account_print_invoice.sxw ~/Desktop
3) Open it in LibreOffice and change something visibly, a title for example
4) Save it and push it back to the server with :
scp ~/Desktop/account_print_invoice.sxw $ME@$REMOTE_HOST:$OPENERP_PATH/openerp/addons/account/report
5) Run this command to generate the rml file :
cd $OPENERP_PATH/openerp/addons/account/report python ../../base_report_designer/openerp_sxw2rml/openerp_sxw2rml.py account_print_invoice.sxw > account_print_invoice.rml
6) Back in OpenERP, Try printing the invoice again. You should see your altered title.
The screw ups
Â¡Generating an rml file from the originally delivered sxw, does not get you the same rml as delivered! The resulting formatted invoice:
- loses it's address information, and
- the title section is altered.
Instead of ...
| Description | Invoice Date | Source | Customer Code |
... I get ...
| Description | Invoice Date | Partner Ref. |
The rml is not hard to read. I found a section entitled "Table_Partner_Address", containing a a macro function
display_address(o.partner_id). Putting that into the sxw, regenerating the rml and then regenerating the report, produced the missing address section. This proved to me that macro functions put in the sxw will work with out any further effort in the rml.
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 platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/16/13, 3:38 PM|
|Seen: 20355 times|
|Last updated: 3/16/15, 8:10 AM|