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.

5

Changing invoice layout

By
Cristian Livadaru
on 2/16/13, 3:38 PM 19,721 views

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?

Thanks.

Hi, Someone knows about the status of report_designer for V7.0 ? Thank you

SISalp
on 2/18/13, 8:37 PM
1
SISalp
On 3/2/13, 4:36 PM

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:

1
Ian Beardslee
On 2/24/13, 6:21 PM

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> >> [edit] >> 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 3.6.2.2 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.

0

Martin

--Martin--
1978
| 5 6 8
Cornwall, Canada
--Martin--

Analysing, designing, coding and mentoring since 1975. Kilobytes to terabytes. Punch cards to punchy sites. My OpenERP video series: http://www.youtube.com/playlist?list=PLq7op4J183lX44ZlXPiHxUpRvmmRDtxye My Google Speadsheets --> OpenERP Data Pump project: http://martinhbramwell.github.io/GData_OpenERP_Data_Pump My email (with spaces removed) : mhb . warehouseman @ gmail . com

Martin
On 2/17/13, 8:26 AM

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:

  1. loses it's address information, and
  2. the title section is altered.

Instead of ...

| Description | Invoice Date | Source | Customer Code |

... I get ...

| Description | Invoice Date | Partner Ref. |

Fixes 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.

0
tlauber
On 3/4/13, 7:47 AM

We switched to using JasperReports and set up a quick solution using a webservice delivering the invoice. For more information have a look in the blog section of our homepage (german language).

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

7 follower(s)

Stats

Asked: 2/16/13, 3:38 PM
Seen: 19721 times
Last updated: 3/16/15, 8:10 AM