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

I want to add timesheet tab of employee in payslip.

My xml code:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="hr_payslip_timesheet_inherit1"
model="ir.ui.view">
<field name="name">HR Payslip Timesheet inherit</field>
<field name="model">hr.payslip</field>
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
<field name="arch" type="xml">
<xpath expr="//form[1]/sheet[1]/notebook[1]" position="inside">
<page name="custom_payslip_timesheet" string="Timesheets">
<field name="timesheet_ids" context="{'default_employee_id': employee_id}" domain="[('employee_id', '=', employee_id)]">
<tree editable="bottom" string="Timesheet Activities" default_order="date">
<field name="date"/>
<field name="user_id" invisible="1"/>
<field name="employee_id" required="1" />
<field name="name"/>
<field name="unit_amount" widget="timesheet_uom"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</data>
</odoo>

And my python code is like below:

from odoo import models, api, fields


class hr_employee(models.Model):
_inherit = 'hr.payslip'

timesheet_ids = fields.One2many('account.analytic.line', 'employee_id', 'Timesheets')

Any kind of help is appreciated

아바타
취소

Hi,

If you are getting any error message using the above code, try to specify it along with the question.

If the above code is not working, change the xpath like this,

<xpath expr="//form/sheet/notebook" position="inside">

작성자

Sorry being not enough clear. I want to achieve to get timesheet ids of employee on each payslip.

관련 게시물 답글 화면 활동
1
3월 15
6677
1
6월 20
4510
1
3월 24
6092
0
8월 20
2838
1
7월 19
4041