Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3315 Lượt xem

how to access unpaid leaves in salary rule while writing the python code 



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can write a rule In the salary rule to deduct the amount from the gross according to the number of Unpaid leaves

result=worked_days.Unpaid and worked_days.Unpaid.number_of_days and -(contract.wage/31)*worked_days.Unpaid.number_of_days or False

For more you can refer this answer https://www.odoo.com/forum/help-1/question/unpaid-leaves-deduction-not-working-16131

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Heloo @hunain,


Phython code :-


# Available variables:
#----------------------
# payslip: object containing the pay slips
# employee: hr.employee object
# contract: hr.contract object
# rules: object containing the rules code (previously computed)
# categories: an object containing the computed salary rule categories 
(sum of amount all rules belonging to that category). 
# worked_days: object containing the computed worked days
# inputs: object containing the computed inputs
# Note: returned value have to be set in the variable 'result'
#Our Computation code to calculate amount In case of 31 days
try:
result =-(contract.wage/31) * worked_days.Unpaid.number_of_days
except:
result = 0
 

Ảnh đại diện
Huỷ bỏ