Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5752 มุมมอง

hello every one,

i need the python code to deduct the employee salary in following scenario.

salary  = 10000/-

employee joining date is 21/01/2017 (middle of the month or any date between in month)

I set the contract start date is 21/01/2017 and end date is 20/01/2018.

when i calculate the salary, Odoo is calculating the whole month salary (10000) instead of  10 days. (from 21 to 31th Jan of the month) how can i create the rule in this regard.


Muhammad Kamran

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Kamran,

You have to use 

worked_days.WORK100.number_of_days

to get the number of days the employee worked and multiply that with the daily wage. Then you have to manage the weekends as well because while they are not working days but you must include them in the total wage.

Set the following Python Code in Basic Salary Rule:

daily = contract.wage/31
days = worked_days.WORK100.number_of_days
weekends = days/5
weekenddays = weekends*2

result = (weekenddays*daily)+(days*daily)

อวตาร
ละทิ้ง

What about the months 30 days and 28 days, can it be dynamic to calculate based on days of the month, instead of fixed 31 days

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 22
3888
0
ม.ค. 20
3191
1
ม.ค. 19
4894
4
ก.ย. 25
6718
2
ธ.ค. 24
12521