This question has been flagged
1 Reply
5948 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

Avatar
Discard
Author

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

Best Answer

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>

Avatar
Discard

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