I want to remove a group from HR Settings section using my customized module.
Section to be removed in hr.view_employee_form has been added by hr_holidays_view.xml using inheritance
hr_view.xml(view_employee_form form)
<page string="HR Settings" groups="base.group_hr_user">
<group>
<group string="Active" name="active_group">
<field name="active"/>
</group>
</group></page>
Code added by hr_holidays_view.xml
<xpath expr="//group[@name='active_group']" position="before">
<group string="Leaves">
<label for="remaining_leaves"/>
<div>
<field name="remaining_leaves" class="oe_inline"/> days
</div>
</group>
</xpath>
Code written by me to remove that Remaining Leaves block, in my customized module is :
<xpath expr="/form/sheet/notebook/page[@string='HR Settings']/group/group[@string='Leaves']" position="replace">
</xpath>
and I am getting following error:
AttributeError: View definition error for inherited view 'custom_emp.emp_code_view_form' on model 'hr.employee': Element '<xpath expr="/form/sheet/notebook/page[@string='HR Settings']/group/group[@string='Leaves']">' not found in parent view 'hr.view_employee_form'
Please help!
Updated Full Code :
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data><!--Employee form view -->
<record id="emp_code_view_form" model="ir.ui.view">
<field name="name">hr.employee.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[@string='HR Settings']/group/group[@string='Leaves']" position="replace">
</xpath>
<xpath expr="/form/sheet/notebook/page[@string='HR Settings']/group/group[@string='Active']/field[@name='active']" position="after"
<field name="working_status" />
</xpath>
</field>
</record>
</data>
</openerp>
Update: Above code is working well on one machine but not other one!!
I have tried <xpath expr="//group[@string='Leaves']" position="replace"> code as well....but no success
Please post your complete custom view declaration.
Code has been updated....2nd xpath tags are working well....