Community mailing list archives
You can find the error in the rule by cutting the code into small pieces and testing small pieces at a time.It will get even more difficult unless you have some python skills.2015-08-05 10:27 GMT+03:00 Iman Ahmad <email@example.com>:it is more difficult nowall i did iscreating three new rules with your instruction each one with the code you told mebut it didnt workhow can i find the errorOn Wed, Aug 5, 2015 at 10:18 AM, Levent Karakas <firstname.lastname@example.org> wrote:
It's not very easy to find errors in salary rules. Try smaller pieces of code and add more till you find the error.
Some hints for you: make sure code exist in structure.5 Ağu 2015 09:22 tarihinde "Iman Ahmad" <email@example.com> yazdı:it gives me this error
Wrong python code defined for salary rule worked_rate (Worked_Rate).On Wed, Aug 5, 2015 at 9:17 AM, Iman Ahmad <firstname.lastname@example.org> wrote:condition must be true or range or python expressionOn Wed, Aug 5, 2015 at 9:13 AM, Levent Karakas <email@example.com> wrote:
Select no condition and python as calculation type. You will have a field to write python code.
I realised i made a mistake: use contract.wage instead of employee.wage.5 Ağu 2015 08:41 tarihinde "Iman Ahmad" <firstname.lastname@example.org> yazdı:Thanks all
Levent Karakas can you please tell me where to write each on of these codes
is it in the salary rule result field ?On Tue, Aug 4, 2015 at 4:18 PM, Levent Karakas <email@example.com> wrote:1) Add a rule to calculate daily rate (DAILY_RATE) with python code like this:result = employee.wage / 302) then you will need to add another rule and use this to count total number of days (WORKED_DAYS) worked like this:result = 0 for line in payslip.worked_days_line_ids: result += line.number_of_days if result >= 28: result = 30odoo automatically decrements leaves from work days (WORK100.days), but unfortunately weekends are not counted here. we added another automatically computed entry here for weekends with python code.3) finally add another rule to calculate the wage:result = DAILY_RATE * WORKED_DAYS
I want to generate payslips which takes the total wage and divide it to 30 and then multiply it by the number of days the employee work (which are equal to 30- leaves )
how can i achieve this
any help ?----