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

How to replace the paper format "European A4" by inheritance ?

By
Theudric Enicar
on 6/18/15, 6:09 AM 657 views

Here my xml file:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
         <template id="replace_paper_format_euro" inherit_id="report.paperformat_euro">
             <xpath expr="//field[@name='margin_left']" position="replace">
                 <field name="margin_left">22</field>
             </xpath>

         </template>
    </data>
</openerp>

Error:

ParseError: "ValidateError

Field(s) `arch` failed against a constraint: Invalid view definition

Error details:

Element '<xpath expr="//field[@name='margin_left']">' cannot be located in parent view

Both, solution and comment below work perfectly ! Thanks to all

Theudric Enicar
on 6/19/15, 3:25 AM
1

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 6/18/15, 9:09 PM

Take a look at the way Odoo is actually creating the record in the database for "European A4".

You will find it in the addons/report/data/report_format.xml file.

 <record id="paperformat_euro" model="report.paperformat"> 
<field name="name">European A4</field> <field name="default" eval="True" /> <field name="format">A4</field> <field name="page_height">0</field> <field name="page_width">0</field> <field name="orientation">Portrait</field> <field name="margin_top">40</field> <field name="margin_bottom">23</field> <field name="margin_left">7</field> <field name="margin_right">7</field> <field name="header_line" eval="False" /> <field name="header_spacing">35</field> <field name="dpi">90</field> </record>

How about an XML file like this instead of what you have:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="paperformat_euro" model="report.paperformat">
<field name="margin_left">22</field>
</record>

</data>
</openerp>

Note that the id must be "report.paperformat_euro" because when inheriting like this, you need to give the full xml name.

Limitless Virtual Enterprise, Andre de Kock
on 6/19/15, 2:51 AM

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

1 follower(s)

Stats

Asked: 6/18/15, 6:09 AM
Seen: 657 times
Last updated: 6/19/15, 3:29 AM