تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3298 أدوات العرض

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
مارس 15
6643
1
يونيو 20
4503
1
مارس 24
6082
0
أغسطس 20
2823
1
يوليو 19
4028