I have a class as below:
class Employee(ModelSQL, ModelView):
"Employee"
__name__ = "afx.employee"
_rec_name = "name"
employee_id = fields.Char("Employee No", required=True)
name = fields.Char("Name", required=True)
And another class that use above class:
class ProjectSales(ModelSQL, ModelView):
__name__ = 'afx.crm.sales'
employee_no = fields.Many2One('afx.employee', 'Employee No', required=True)
name = fields.Char('Name', required=True, states={
'readonly': True,
},)
@fields.depends('employee_no')
def on_change_with_name(self, name=None):
if self.employee_no:
return self.employee_no.name
return ''
Since the _rec_name of Employee class pointing to ‘name’ field, and already use by many other classes, all front-end of those classes displays employee’s name in the front end.
Problem: currently, the frontend that use ProjectSales class displays the employee’s name too. while it is required is to show the employee_id of the Employee object instead of following the _rec_name setup.
How to show the employee_id value at ProjectSales front-end?
Bromo