This question has been flagged
3 Replies
3890 Views

I've created a salary rule (IRG) depending on another rule (SALIMPARND) as follow:

if SALIMPARND <= 15000:

    resutlt = 0

elif 15000 < SALIMPARND and SALIMPARND <= 22500:

    result = (SALIMPARND - 15000) * 0.2

elif 22500 < SALIMPARND and SALIMPARND <= 28750:

    result = (SALIMPARND - 22500) * 0.12 + 1500

elif 28750 < SALIMPARND and SALIMPARND <= 30000:

    result = (SALIMPARND - 29000) * 0.2 + 2300

elif 30000 < SALIMPARND and SALIMPARND <= 120000:

    result = (SALIMPARND - 30000) * 0.3 + 2500

else:

    result = (SALIMPARND - 120000) * 0.35 + 29500

 

All working fine, and the payslips are calculated accurately, except for the first condition (when SALIMPARND <= 15000) the given result for the rule IRG is equal to 1 instead of 0.

After some search i've found this good description of the BUG (reported on 2012-09-01 thanks to Robajz.info)   (https://bugs.launchpad.net/openobject-addons/+bug/1044611), but infortunately the fix didn't work for me.

Why this old issue is not fixed till today?

Is the error related to the method compute_rule or to safe_eval ?

Any idea on how to fix this issue ?

NB: using OpenERP V7.0, but i think that this issue is reproducible under other Odoo versions.

 

Avatar
Discard
Best Answer

Syntax in resutlt ?

if SALIMPARND <= 15000:

resutlt = 0

replace by

if SALIMPARND <= 15000:

result = 0

Avatar
Discard
Author Best Answer

Thank you  Blue Eyes, that's it !!!

This reveals another BUG: Why no "SyntaxError"  or "TypeError" raised

Thank you zbik.

Avatar
Discard

Yes, issue should be reported.

Author

Thank''s zbik

Best Answer

Bonjour 

Comment peut ont mettre 2 bulletin de paie sur une fauille A4 pour 2 employers ,

 

 

 

Avatar
Discard