Skip to Content
Menu
This question has been flagged
21 Replies
19762 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

Avatar
Discard

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

[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.).

Author

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

Author

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

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

@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?

Best Answer

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 !

Avatar
Discard

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

Best Answer

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Best Answer

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.

Avatar
Discard
Best Answer

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/

Avatar
Discard
Author

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

Author

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.

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.

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

Best Answer

Which version of odoo are you using ?

Avatar
Discard
Author

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

Best Answer

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

Avatar
Discard
Author Best Answer

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

Avatar
Discard

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