Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
คำถามนี้ถูกปิดแล้ว เนื่องจาก: ไม่มีความเกี่ยวข้องหรือล้าสมัย โดย Balagopal R เมื่อ 21/05/2024 02:19:46
1216 มุมมอง

So, I want inherit into hr.leave like this in inherit cutome view:

field name="name">hr.leave.inherit            
field name="model">hr.leave           
field name="inherit_id" ref="hr_holidays.hr_leave_view_form_manager_approve"/>
field name="arch" type="xml">
                xpath expr="//group/widget[@name='hr_leave_stats']" position="replace">
                    field name="employee_id" invisible="0"/>
                    group class="mt-0">
                        field name="allocation_display"/>
                    /group>
                    field name="department_id" invisible="0"/>
                /xpath>
                xpath expr="//field[@name='allocation_display']" position="after">
                    field name="allocation_used_display" domain="[('state', '=', 'validate')]"/>
                /xpath>
                xpath expr="//field[@name='allocation_used_display']" position="after">
                    field name="remaining_leaves" />
                /xpath>
            /field>

and this I added code into the model:

_inherit = 'hr.leave'
allocation_display = fields.Char(related='employee_id.allocation_display', string="Allocation Time Off")
    allocation_used_display = fields.Char(related='employee_id.allocation_used_display', domain="[('state', '=', 'validate')]", compute='_compute_total_allocation_used', string="Total number of days off used")
    remaining_leaves = fields.Float(related='employee_id.remaining_leaves',string='Remaining Paid Time Off')
    current_leave_state = fields.Selection(related='employee_id.current_leave_state')

So, in above, I tried filtering 'allocation_used_display' field, so, this field only show the sum of number paid time off where's in state = 'validate' only. I already tried using domain, but it doesn't work. 


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 25
2954
2
ส.ค. 20
4773
2
ก.ค. 23
7116
2
พ.ค. 23
2102
1
ม.ค. 23
2333