Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5791 Tampilan

Hi all,

I've been going through the forum for this matter for a while now. The only solution provided is to obtain the number of unpaid leaves applied at the Leave module and translated into salary deduction at the Payroll module.

However, my situation is a bit different.

My employee could have forgotten to apply for an Unpaid leave which was supposed to be taken a month before. Once the Unpaid leave is applied, the current python code does not take into account the deduction from last month and this result in the wrong salary provided. 

This is the current code I'm using:

Conditions:
result=worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

Computations:
result=-(contract.wage/26) * worked_days.Unpaid.number_of_days

This code works only if the Unpaid leave is taken in the same month before payroll is closed. I'm using Odoo 12 for Windows.

Please help.

Thanks in advance.
Avatar
Buang
Penulis Jawaban Terbai

Yes! Managed to get it to work. These are steps that I've taken:

  1. Create a salary rule. I call it Unpaid Leave

  2. Set the Conditions to be Always True

  3. At Computations, select Python Code. I use this: result=(inputs.UNPAID and + (inputs.UNPAID.amount))*(-contract.wage/26)

  4. Remember to include in the Input tab the appropriate information. In my case, I set Unpaid Leave as Description and UNPAID as Code.

Do give me a positive vote if it helps. Thanks =)

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Mar 23
1714
1
Sep 25
600
1
Mei 25
1878
1
Mar 25
1631
0
Feb 25
1968