This question has been flagged
2 Replies
4714 Views

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>

and I got error when upgrade the module 

can any body help me please 
Avatar
Discard
Best Answer

Hi,

Please do check the following blog to add a smart button  to an inherit form.

Avatar
Discard
Best Answer

Hi,

Please refer to this,

https://www.odoo.com/es_ES/forum/ayuda-1/how-can-i-add-a-smart-button-to-an-existing-model-having-no-smart-buttons-157810

Muhammed Ali M - iWesabe

Avatar
Discard