Community: Framework mailing list archives

expert-framework@mail.odoo.com

fields_view_get getting "old" fields.

by
manuel
- 01/28/2015 09:35:43
Hi all,

We have a custom addon that modifies the behavior and looks of the hr_holidays addons.  We have a version 1.6 installed and now we're trying to deploy version 1.7.  The addons previously introduced several fields (for instance,  "period_to") that are now being removed.  Upon updating the DB those fields are being returned by the fields_view_get despite they are not present in the XML.  Is this a bug in OpenERP 7.0?

I have worked around this issue by simply deleting the ir_ui_view row before running the update.

Here is the error and the XML:

except_orm: ('View error', u"Can't find field 'period_to' in the following view parts composing the view of object model 'hr.holidays':\n * Allocation Request\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model")
2015-01-28 03:27:18,315 32649 ERROR mercurio openerp.tools.convert: Parse error in /home/manu/src/merchise/pgi/xopgi.hr_holidays/xopgi/xopgi_hr_holidays/view/holidays.xml:104:
<record id="allocation_leave_new_conditional_admin" model="ir.ui.view">
      <field name="name">Allocation Request</field>
      <field name="model">hr.holidays</field>
      <field name="inherit_id" ref="hr_holidays.allocation_leave_new"/>
      <field name="arch" type="xml">
        <data><field name="state" position="after">
          <field name="workflow_active" invisible="1"/>
          <field name="on_previous_period" invisible="1"/>
        </field>
        <xpath expr="//header/button" position="attributes">
          <attribute name="attrs">
            {'invisible': ['|',('workflow_active','!=', True),
                           '|',('on_previous_period', '=', True)]}
          </attribute>
        </xpath>
        <button name="refuse" position="replace">
          <button string="Refuse" name="refuse" states="confirm,validate1,validate" type="workflow" groups="base.group_hr_user" attrs="{'invisible': [                          '|',('workflow_active','!=', True),                          '|',('on_previous_period', '=', True)                          ]}"/>
        </button>
        <button name="set_to_draft" position="replace">
          <button string="Reset to New" name="set_to_draft" states="refuse" type="object" groups="base.group_hr_user" attrs="{'invisible': [                          '|',('workflow_active','!=', True),                          '|',('on_previous_period', '=', True)                          ]}"/>
        </button>
        <field name="holiday_status_id" position="after">
          <label for="date_from" string="Active date"/>
          <field name="date_from" nolabel="1" class="oe_inline" attrs="{'readonly': [('on_previous_period','=',True)]}" required="1"/>
          <field name="from_next_period" class="oe_inline" attrs="{'invisible':                         ['|', ('holiday_status_id','!=',1),                         '|', ('holiday_type', '!=', 'employee'),                         '|', ('on_previous_period', '=', True)]}"/>
          <field name="day_off" class="oe_inline" attrs="{'invisible': [('holiday_status_id','!=',3)]}"/>
        </field>
        <xpath expr="//field[@name='name']" position="attributes">
          <attribute name="attrs">
            {'readonly':['|', ('on_previous_period', '=', True),
                         ('state','not in',['draft', 'confirm'])]}
          </attribute>
        </xpath>
        <xpath expr="//field[@name='holiday_status_id']" position="attributes">
          <attribute name="attrs">
            {'readonly':[('on_previous_period','=',True)]}
          </attribute>
          <attribute name="domain">[('limit', '!=', True)]</attribute>
        </xpath>
        <xpath expr="//field[@name='number_of_days_temp']" position="attributes">
          <attribute name="attrs">
            {'readonly':[('on_previous_period','=',True)]}
          </attribute>
        </xpath>
        <xpath expr="//field[@name='holiday_type']" position="attributes">
          <attribute name="attrs">
            {'readonly': ['|', ('on_previous_period','=',True),
                          '|', ('from_next_period','=',True)]}
          </attribute>
        </xpath>
        <xpath expr="//field[@name='employee_id']" position="attributes">
          <attribute name="attrs">
            {'required': [('holiday_type','=','employee')],
             'invisible': [('holiday_type','=','category')],
             'readonly': [('on_previous_period','=',True)]}
          </attribute>
        </xpath>
        <xpath expr="//field[@name='department_id']" position="attributes">
          <attribute name="attrs">
            {'invisible': [('holiday_type','=','category')],
             'readonly': [('on_previous_period','=',True)]}
          </attribute>
        </xpath>
      </data></field>
    </record>