Search code examples
inheritanceviewcontract

Inherit view error when install module contract hr_contract_state OpenERP /Odoo 8.0


I have install module Attendance summary for Payroll and I get the following error:

ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
 Element '<xpath expr="//button[@string='Contracts']">' cannot be located in parent view

 Error context:
View `hr.employee.view.form.contract_state`
[view_id: 1112, xml_id: n/a, model: hr.employee, parent_id: 393]" while parsing file:///E:/ERP/odoo8/Odoo/odoo-8.0/openerp/addons/hr_contract_state  /hr_contract_view.xml:147, near
<record id="hr_hr_employee_view_form2" model="ir.ui.view">
    <field name="name">hr.employee.view.form.contract_state</field>
    <field name="model">hr.employee</field>
    <field name="inherit_id" ref="hr_contract.hr_hr_employee_view_form2"/>
    <field name="arch" type="xml">
        <data>
            <xpath expr="//button[@string='Contracts']" position="replace">
                <button name="%(hr_contract.act_hr_employee_2_hr_contract)d" string="Contracts" type="action" groups="base.group_hr_user"/>
            </xpath>
        </data>
    </field>
</record>

Please help me and thanks for helping.


Solution

  • That button doesnt exist in that view. Edit that view and Try with this (after the data tag):

    <field name="contracts_count" position="replace">
        <button name="%(hr_contract.act_hr_employee_2_hr_contract)d" string="Contracts" type="action" groups="base.group_hr_user"/>
    </field>
    

    instead of xpath.