콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
6767 화면

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 
아바타
취소
베스트 답변

Hi,

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

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
8월 16
8274
1
1월 18
8650
1
11월 22
6798
2
8월 16
7386
2
3월 15
6217