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

Dear all,
I have a when Generate Payslip for employee when Employee creates two leave with two time off types.
For example:
- A leave with time off types is Paid time off from 8:00am to 10:00am and another leave from 10:00am to 1:00pm (Time off types is Sick time off).
Both vacations are for 1 day.
When Generate Payslips for that employee, there is ValueError: Expected singleton: hr.leave.type(1, 7)

File "/home/developer/Desktop/tvs_project/odoo16_base_addons/addons/web/controllers/dataset.py", line 33, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/developer/Desktop/tvs_project/odoo16_base_addons/odoo/api.py", line 461, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/home/developer/Desktop/tvs_project/odoo16_base_addons/odoo/api.py", line 448, in _call_kw_multi result = method(recs, *args, **kwargs) File "/home/developer/Desktop/tvs_project/third_app/om_hr_payroll/wizard/hr_payroll_payslips_by_employees.py", line 25, in compute_sheet slip_data = self.env['hr.payslip'].onchange_employee_id(from_date, to_date, employee.id, contract_id=False) File "/home/developer/Desktop/tvs_project/third_app/om_hr_payroll/models/hr_payslip.py", line 463, in onchange_employee_id worked_days_line_ids = self.get_worked_day_lines(contracts, date_from, date_to) File "/home/developer/Desktop/tvs_project/third_app/om_hr_payroll/models/hr_payslip.py", line 209, in get_worked_day_lines 'name': holiday.holiday_status_id.name or _('Global Leaves'), File "/home/developer/Desktop/tvs_project/odoo16_base_addons/odoo/fields.py", line 1132, in __get__ record.ensure_one() File "/home/developer/Desktop/tvs_project/odoo16_base_addons/odoo/models.py", line 5119, in ensure_one raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: hr.leave.type(1, 7)


Imagine profil
Abandonează
Cel mai bun răspuns

Please share the code of your Function that is causing the error.

The function is recieving two records. But it expects only one record. You just have to make a slight change in the loops of your function.


Imagine profil
Abandonează
Cel mai bun răspuns

Hi  Nam Nguyen Phuong,

It's a bug with the third-party app you installed named 'om_hr_payroll'. You can check whether the author solved the issue by pulling the latest code.


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
sept. 24
2531
1
aug. 23
3569
3
sept. 24
2445
2
ian. 24
3330
0
aug. 23
2625