First I Inherit hr.employee model in my custom module and add a field unique_id. Than in my custom module I inherit hr.employee search view for this unique_id field. But throw this error, Field "unique_id " does not exist in model "hr.employee"
Here is python file:
class HrUniqueId(models.Model):
_inherit = "hr.employee"
unique_id = fields.Char(string='ID', required=True, copy=False, readonly=True,
default=lambda self: _('New'))
Here is XMLfile:
<record model="ir.ui.view" id="hr_employee_search_inherit">
<field name="name">hr.employee.search.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter"/>
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<field name="unique_id" string="Employee Id"/>
</xpath>
</field>
</record>
Error massage is:
<search string="Employees">
<field name="name" string="Employee" filter_domain="['|', ('work_email', 'ilike', self), ('name', 'ilike', self)]"/>
<field name="category_ids" groups="hr.group_hr_user"/>
<field name="job_id"/>
<separator/>
Field "unique_id" does not exist in model "hr.employee"
View error context:
{'file': 'c:\\odoo\\fornew\\fornew\\odoo\\custom\\employee_details\\views\\employee_details.xml',
'line': 3,
'name': 'hr.employee.search.inherit',
'view': ir.ui.view(2023,),
'view.model': 'hr.employee',
'view.parent': ir.ui.view(366,),
'xmlid': 'hr_employee_search_inherit'}