Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3117 Vizualizări

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

Imagine profil
Abandonează

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">

Autor

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

Related Posts Răspunsuri Vizualizări Activitate
1
mar. 15
6459
1
iun. 20
4283
1
mar. 24
5909
0
aug. 20
2703
1
iul. 19
3773