Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
1745 Представления

Wrong python code defined for: - Employee: xyz - Contract: 001 - Payslip: January 2024 - Salary rule: Basic Salary (BASE) - Error: : "'dict' object has no attribute 'WORK100'" while evaluating 'if employee.department_id == "Production" and contract.eligible_for_bonus == "yes":\n result = contract.wage * ((worked_days.WORK100 and worked_days.WORK100.number_of_days) +\n (worked_days.NUIT and worked_days.NUIT.number_of_days) +\n (worked_days.Halfday and worked_days.Halfday.number_of_days) +\n (worked_days.COC and worked_days.COC.number_of_days) +\n (worked_days.AJ and worked_days.AJ.number_of_days) +\n (worked_days.MAL and worked_days.MAL.number_of_days) +\n (worked_days.SAM and 


WORK100 is base work entry code still its not accepting it. 


anyone can help to solve this error ?

Аватар
Отменить
Лучший ответ

The error you're encountering is a classic case of trying to access a dictionary item as if it were an attribute. Python dictionaries work a bit differently than objects when it comes to accessing their elements.

Your code snippet is trying to get WORK100 and other keys as attributes of worked_days, which is likely a dictionary. In Python, you'd use worked_days['WORK100'] instead of worked_days.WORK100 to access a dictionary value by its key.
Odoo Beratung Deutschland

Аватар
Отменить
Автор

Thanks for the Answer the error is resolved as code defined as per your suggestion but one more issue is arise there is no any line shows in Salary Computation tab it shows only 2 lines all other lines are invisible.

i have attached image in above answer

Автор Лучший ответ

Thanks for the Answer the error is resolved as code defined as per your suggestion but one more issue is arise there is no any line shows in Salary Computation tab it shows only 2 lines all other lines are invisible.



Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
мая 25
2682
2
мая 25
6114
1
мар. 25
1798
4
мар. 25
4667
3
февр. 25
5748