purchase_analytic_plan XML view error

Asked by D Verhelst

purchase_analytic_plans/purchase_analytic_plans_view.xml
seems to contain invalid code :

<!-- Replace analytic_id with analytics_id in account.invoice.line -->

    <record model="ir.ui.view" id="invoice_supplier_form_inherit">
        <field name="name">account.invoice.supplier.form.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_supplier_form"/>
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <field name="account_analytic_id" position="replace">
                <field name="analytics_id" domain="[('plan_id','&lt;&gt;',False)]" context="{'journal_id':parent.journal_id}" groups="analytic.group_analytic_accounting"/>
            </field>
        </field>
    </record>

comment implies account.invoice.line.
the actual code tries to update account.invoice.
analytics_id exists on account.invoice.line, not on account.invoice.

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #1263218.

Revision history for this message
D Verhelst (dimitriverhelst) said :
#1

purchase_analytic_plans/purchase_analytic_plans_view.xml
seems to contain invalid code :

<!-- Replace analytic_id with analytics_id in account.invoice.line -->

    <record model="ir.ui.view" id="invoice_supplier_form_inherit">
        <field name="name">account.invoice.supplier.form.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_supplier_form"/>
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <field name="account_analytic_id" position="replace">
                <field name="analytics_id" domain="[('plan_id','&lt;&gt;',False)]" context="{'journal_id':parent.journal_id}" groups="analytic.group_analytic_accounting"/>
            </field>
        </field>
    </record>

comment implies account.invoice.line.
the actual code tries to update account.invoice.
analytics_id exists on account.invoice.line, not on account.invoice.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#2

Dimitri,

There actually is no problem with any xml part here.

The xml record inherits the Invoice model for changing the analytic, because the invoice lines are inline.

From the xml arch,the field field is found inside the invoice line, so that will be replaced as per the new xml.

Did you encounter any traceback or unnecessary behavior on the view?

Hope this helps.

Thanks.

Revision history for this message
D Verhelst (dimitriverhelst) said :
#3

Hi SCS,

When upgrading a database from 7.0 beta to current LTS release I encounter the following error:
Could it be that the upgrade functionality doesn't understand inline inheritance ?

except_orm: ('View error', u"Can't find field 'analytics_id' in the following view parts composing the view of object model 'account.invoice':\n * account.invoice.supplier.form.inherit\n * account.invoice.supplier.form.inherit\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model")
2013-12-20 19:28:01,485 13989 ERROR tlt_live1 openerp.tools.convert: Parse error in /home/niels/Downloads/server-7LTS/openerp/addons/purchase_analytic_plans/purchase_analytic_plans_view.xml:47:
<record model="ir.ui.view" id="invoice_supplier_form_inherit">
       <field name="name">account.invoice.supplier.form.inherit</field>
       <field name="model">account.invoice</field>
       <field name="inherit_id" ref="account.invoice_supplier_form"/>
       <field name="priority">2</field>
       <field name="arch" type="xml">
           <field name="account_analytic_id" position="replace">
               <field name="analytics_id" domain="[('plan_id','&lt;&gt;',False)]" context="{'journal_id':parent.journal_id}" groups="analytic.group_analytic_accounting"/>
           </field>
       </field>
   </record>

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#4

Dimitri,

Its not so.

One possbility is, you have a custom module and its installed prior to purchase_analytic_plans.

And, I still believe it should better be Xpath to be used for the field operations on inheritance of view.

Thanks.

Revision history for this message
Thibault Duverger (tduverger) said :
#5

I Have the same problem
How can i solve it?

Can you help with this problem?

Provide an answer of your own, or ask D Verhelst for more information if necessary.

To post a message you must log in.