7.0 must not allow loading xml without check

Bug #1093784 reported by Ferdinand
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Hello

it seems to be possible to load invalid xpath expressions, which are only validated during next update BEFORE the new correct xpath is loaded.

the only way to fix this is to delete the view definition manually in the UI.

the error messages is a bit miss leading - it mentions the wrong xpath line, but then it shows the first view definition of the file regardless if this one is the one causing the problem or not.

Example
- <xpath expr="/form/notebook/page[@string='Cash Transactions']/field/form/group/field[@name='account_id']" position="replace">
+ <xpath expr="/form/sheet/notebook/page[@string='Cash Transactions']/field/form/group/field[@name='account_id']" position="replace">

Revision history for this message
Ferdinand (office-chricar) wrote :

another Example

the attribute error comes from another view

AttributeError: View definition error for inherited view 'stock_get_name_qty.picking_location_context_view' on model 'stock.picking': Element '<xpath expr="/form/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']/group/field[@name='location_id']">' not found in parent view 'stock.view_picking_form'
2012-12-26 12:03:22,634 10902 ERROR test_25 openerp.tools.convert: Parse error in /home/gass/OpenERP/7.0/server/openerp/addons/c2c_stock_accounting/stock_view.xml:5:
<record model="ir.ui.view" id="picking_values_view">
      <field name="name">view_picking_values.view</field>
      <field name="model">stock.picking</field>
      <field name="inherit_id" ref="stock.view_picking_form"/>
      <field name="arch" type="xml">
        <xpath expr="/form/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
          <group colspan="2" col="2" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant">
            <separator string="Values" colspan="2"/>
            <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
            <field name="move_value_sale" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
            <field name="period_id"/>
          </group>
        </xpath>
      </field>
    </record>

Revision history for this message
Ferdinand (office-chricar) wrote :

I think this happens if a dependent module causes automatic installation of a "dependency" module

Revision history for this message
Ferdinand (office-chricar) wrote :

Here comes a simple test case attached

this module
* can be installed from command line with --init=account_invoice_refund and
* will fail using --update=account_invoice_refund

hence loading modules can create inconsistent / erroneous data base states

Revision history for this message
Ferdinand (office-chricar) wrote :
summary: - 7.0 must not allow loading incorrect xpath expression
+ 7.0 must not allow loading xml without check
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi,

I confirm this issue. That's really annoying and disturbing because the error is not an accurate when we upgrade the module (it displays the error of the view stored in the DB even the view in the addon's file has been corrected meanwhile).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.