Hello,
I have to create new custom_module that add fields to the hr_employees view.
One of the fields I have to view, is the private mobile number of the employee, which is exist now in the related res_partner model.
How can I get it in the new custom module?
I tried to write like taht, but got the error:
Field `mobile` does not exist
model.py file:
from odoo import models, fields, apiclass hr_employees_custom(models.Model):_inherit = ['hr.employee']mobile = fields.Char(related='address_home_id.phone', related_sudo=False,string="Private Mobile", groups="hr.group_hr_user")
views.xml file:
<?xml version="1.0" encoding="utf-8"?><odoo><data><record id="view_employee_form_custom_inherit" model="ir.ui.view" ><field name="name">hr.employee.custom.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="//page[@name='personal_information']" position="inside"><group string="Phone"><field name="phone" class="o_force_ltr" groups="hr.group_hr_user" string="Phone"/><field name="mobile" class="o_force_ltr" groups="hr.group_hr_user" string="Mobile"/></group></group></xpath></field></record></data>