Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1866 Zobrazení

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'

Avatar
Zrušit

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

Autor Nejlepší odpověď

yes, it exactly that a want to do

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 25
2128
0
říj 16
5266
1
zář 23
4106
5
srp 22
13976
1
lis 19
3514