Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How could I get the service cost price in a python rule for salary?

By
Pascal Tremblay
on 12/20/14, 10:44 AM 1,244 views

Hello all,

I have an employee. A product is linked with this employee :

The product cost is 12.5 $ per worked hour :

 

How could I get this 12.5 $ in this python rule for salary?

(here, I write PRODUCT.COST, but it is not good)

Debug :

This one work if calculate in pay slip : result = worked_days.WORK100.number_of_hours * 12.5

This one doesn't work if I calculate in payslip (error) : result = worked_days.WORK100.number_of_hours * employee.product_id.cost

Change to: result = worked_days.WORK100.number_of_hours * employee.product_id.standard_price

zbik
on 12/20/14, 1:29 PM

It was exactly what I needed. Thanks a lot!

Pascal Tremblay
on 12/20/14, 1:30 PM
1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 12/20/14, 11:06 AM

Test the value:

employee.product_id.standard_price

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

doesn't work sorry and thanks

Pascal Tremblay
on 12/20/14, 11:43 AM

Sorry, wrong name of the field, corrected.

zbik
on 12/20/14, 12:10 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/20/14, 10:44 AM
Seen: 1244 times
Last updated: 3/16/15, 8:10 AM