Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6655 Lượt xem

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 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 16
8184
1
thg 1 18
8566
1
thg 11 22
6668
2
thg 8 16
7327
2
thg 3 15
6110