hello guys I need help please
I just inherit Employee Model and need to add some extensions on it :
here's my inherit model :
class EmployeeInherit(models.Model):
_inherit = 'hr.employee'
complaint = fields.One2many('complaint', 'employee', string="Complaint")
complaint_count = fields.Integer(
string="Complaint count", compute='_get_complaint_count', store=True)
@api.depends('complaint')
def _get_complaint_count(self):
for r in self:
r.complaint_count = len(r.complaint)
I need to add a smart button in Employee form when press on it show the complaints for this employee :
and here's the form inherited in xml :
<record id="inherit_employee_form" model="ir.ui.view">
<field name="name">employee.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<button name="346" position = "after">
<button type="object" name="get_complaints" string ="Complaints"/>
</button>
</field>
</record>
can any body help me please