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

Odoo v8 - Modified reports invoice / sales_order and external.layout.footer / header keep being replaced with originals

By
NIcolas Plée
on 12/15/14, 5:12 AM 8,190 views

Hi,

I'm getting very frustrated with Odoo. I was able to adapt the design of following elements to my needs :

  • external_layout_header
  • external_layout_footer
  • account.report_invoice_document
  • sale.report_saleorder_document

Unfortunately, they were replaced with originals several times now.

First time I thought it was related to an update of Odoo I did but this week-end, after doing again all the modifications I needed on these elements, no update were done nor the server or Odoo even restarted but still they were reinitialized. :-(

As I hadn't saved everything, I'll have to do the modification again. 

Can any baody explain me what happens and how I can prevent this ?

Thanks a lot

Nicolas

@Nicolas, If you're running on your own instance that you have terminal access to i'd recommend creating a simple module to customise the views you need to customise. This way your changes will be kept intact regardless of database and module upgrades and they changes will be easily transferrable to another database or instance. I'll be putting up a demonstration module here soon: https://github.com/OdooCommunityWidgets/product_image_report_order_lines that will achieve some basic formatting changes for the default documents (quotation, invoice, etc.) that I need for my company to include images on order lines (among other things) that should demonstrate a method of customising the default report documents to create your own customisations.

Luke Branch
on 12/15/14, 9:42 PM

[UPDATE]: this module has been renamed and moved to: https://github.com/OdooCommunityWidgets/product_extended_report_order_lines to allow for more features to be included in it for customising reports for commonly required customisations (eg. image on sales order line, customer's stock code, etc.).

Luke Branch
on 12/17/14, 5:19 AM

Thank you for much for sharing your work. it will be very helpful ! I'm looking forward to.

NIcolas Plée
on 12/17/14, 10:49 AM

Thank you for much for sharing your work. it will be very helpful ! I'm looking forward to.

NIcolas Plée
on 12/17/14, 10:49 AM

Hey Luke, your module seems empty now on https://github.com/OdooCommunityWidgets/product_extended_report_order_lines

Pascal Tremblay
on 12/20/14, 2:05 PM

@Pascal, Yes the module is simply acting as a placeholder for now. I'd recommend following the module on github. I'll be working on separating the report customisation features I built into a client's website theme module so that they work as a standalone module as soon as I can find some time. Could you let me know if there are any specific fields or features you'd like to suggest for this module?

Luke Branch
on 12/22/14, 11:46 PM
4

Parikshit

--Parikshit--
939
| 6 3 8
Ahmedabad, India
--Parikshit--

Working as an OpenERP/Odoo developer both experience in web and addons. you can contact me at:

E-mail : parikshitvaghasiya@gmail.com

Blog : parikshitvaghasiya.blogspot.in

Stackoverflow : http://stackoverflow.com/users/5089106/parikshit-vaghasiya

Parikshit
On 9/1/15, 1:08 AM

Hello,

For account report code in your xml file :

 <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
            <template id="account.report_invoice_document">
             Your Account Report
            </template>
        </data>
   </openerp>

For Header Footer you have to do like this : 

  <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
            <template id="account.report_invoice_document">
                <t t-foreach="docs" t-as="o">                 <t t-call="module_name.extend_layout">
                        Your Report            
                    </t>
                </t>
            </template>
        </data>
   </openerp>

Now, Code for Custom Header and Footer :

 <template id="extend_layout">
    <t t-if="o and 'company_id' in o">
        <t t-set="company" t-value="o.company_id"></t>
    </t>
    <t t-if="not o or not 'company_id' in o">
        <t t-set="company" t-value="res_company"></t>
    </t>
    <t t-call="module_name.report_header" />
    <t t-raw="0" />
    <t t-call="module_name.report_footer" />
</template>

<template id="report_header">
    <div class="header">
         Your Report Header     
</div> </template> <template id="report_footer"> <div class="footer">
        Your Report Footer </div> </template>

You can code for sale order report just give template id="sale.report_saleorder_document".

Thank you !

Can you be more specific, where i put this code in the original views or create a new module?

Carlos
on 11/20/15, 1:35 PM
1
zuher83
On 12/17/14, 7:39 AM

Use inherit views: 

1 - create new module:

2 - Add new xml file exemple: report_partnerledger.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_partnerledger" inherit_id="account.report_partnerledger" >
            <xpath expr="//div[@class='page']" position="replace">
                <div class="page">
                  ........................

 

same method with layout !
if you want you can add in layout file with inherit new header_layout...

0
MORILLON AURELIEN
On 10/21/16, 7:42 AM

Bonjour,

J'ai fais une erreur de manip et j'ai écrasé le rapport "report_invoice_document".

Y a-t-il un historique des modif ?

Comment puis-je récupérer le XML original ?

J'utilise la Version 8.0-20161020

Merci par avance

Aurélien

0
Carlos
On 11/20/15, 11:49 AM

Hi, some one can help me i have a module but i want create a style file .css to personalize my module but i do not how add the path in my xml file and where i can save the .css file.

0
Mayjonade
On 12/17/14, 11:52 AM

http://lolierp.blogspot.fr/2014/08/odoo-v8-modification-dune-edition-qweb.html

0

zbik

--zbik--
5976
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 12/15/14, 6:08 AM

There are two ways, that I know, of that can you protect your work:
1. Use a Custom View reports (own module).
2. The security standard views, by inserting them, before performing the update (in .xml files - for example in account/views/report_invoice.xml)

<data noupdate = "1">

All views without setting "noupdate" are normally overwritten by new version. See: https://doc.odoo.com/6.0/developer/5_18_upgrading_server/

Error message: Thank you for your reply zbik. I actually added the the following way : .... I must have done something wrong because I get following error when creating the reports... "Template 'sale.report_saleorder_document' not found" while evaluating "translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"

NIcolas Plée
on 12/15/14, 12:07 PM

I'm a bit lost now with the process to modify reports... I actually tried to apply all the changes I had done in report_saleorder_document (through web interface) into addons/sale/views/report_saleorder.xml and then updated the module. But when I print (HTML) the report, the info from report_saleorder_document are still shown. I also made an attempt with addons/report/views/layouts.xml by changing external_layout_header template and restarted Odoo but no change happens on my printed report. Any help would be greatly appreciated.

NIcolas Plée
on 12/19/14, 7:01 AM

1. Current xml report view exists in database 2. Report templates is defined in foo.xml file (may be many views in one xml), but not currently used. 3. Where module upgrade, xml from foo.xml file (many ) replace xml views in database. Only If "noupdate" for tag , in foo.xml, is set to "1", with this data settings (children tag ) are not replaced.

zbik
on 12/20/14, 5:49 PM

(Correction lost tags syntax) 1. Current xml report view exists in database 2. Report templates is defined in foo.xml file (may be many views in one xml), but not currently used. 3. Where module upgrade, xml from foo.xml file (many "records") replace xml views in database. Only If "noupdate" for tag "data", in foo.xml, is set to "1", "records" with this "data" settings (children tag "data") are not replaced.

zbik
on 12/20/14, 6:01 PM
0
Fouric
On 12/15/14, 12:37 PM

Which version of odoo are you using ?

Thanks for asking, I just modified the title according to this.

NIcolas Plée
on 12/16/14, 5:54 AM
0
NIcolas Plée
On 12/15/14, 11:38 AM

Thank you for your reply zbik.

I actually added the <data noupdate=1>  the following way :

<?xml version="1.0"?>
<data noupdate="1">

....

</data>

 

Edit :I must have done something wrong because I get following error when creating the reports...

"Template 'sale.report_saleorder_document' not found" while evaluating "translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"

You probably edited the view in database rather than the report_saleorder.xml file?

zbik
on 12/15/14, 12:41 PM

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

6 follower(s)

Stats

Asked: 12/15/14, 5:12 AM
Seen: 8190 times
Last updated: 10/21/16, 7:42 AM