Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1851 Widoki

hello !

I am working on the payroll module in Odoo 17 and I have successfully created all the necessary salary rules. Everything is working fine, however, I have been asked to display the workplace of each employee in the salary statement report.

I first tried to create a salary rule that would retrieve the employee's workplace from their profile and put it into the 'result' variable, but each time the system tells me that it is impossible to convert a string to a float.

I am posting the code I used here along with the error message, hoping that someone will be able to help me.


code 

# Available variables:
#----------------------
# payslip: hr.payslip object
# employee: hr.employee object
# contract: hr.contract object
# rules: dict containing the rules code (previously computed)
# categories: dict containing the computed salary rule categories (sum of amount of all rules belonging to that category).
# worked_days: dict containing the computed worked days
# inputs: dict containing the computed inputs.

# Note: returned value have to be set in the variable 'result'
#string work_location_name,
#work_location_name = str(employee.work_location_id.name) if employee.work_location_id else ''
#a = employee.work_location_id
work_location_name = employee.work_location_id.name if employee.work_location_id else ''

result=str (work_location_name)


message d'erreur 

Mauvais code Python défini pour : - Employé : ABOUBAKAR SIDDIK - Contrat : CDI5 - Fiche de paie : Bulletin de paie - ABOUBAKAR SIDDIK - avril 2024 - Règle salariale : Lieux de travail (LI) - Erreur : could not convert string to float: 'Direction Générale'

Awatar
Odrzuć

Hello aboubakr,
the question here is what you are trying to achieve by setting the amount value on the payslip to a string?

Autor Najlepsza odpowiedź

yes, it exactly that a want to do

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 25
2113
0
paź 16
5256
1
wrz 23
4094
5
sie 22
13960
1
lis 19
3512