Skip to Content
Menu
This question has been flagged

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
Discard

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

Author Best Answer

yes, it exactly that a want to do

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 25
1886
0
Oct 16
5089
1
Sep 23
3887
5
Aug 22
13744
1
Nov 19
3408