# hr_payroll: salary rule computation BUG ?

By
Med Said BARA
on 11/25/14, 11:09 AM 2,214 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.

#### Zbik

--Zbik--
6805
| 6 5 7
Lodz, Poland
--Zbik--

Zbik
On 12/20/14, 6:28 PM

Syntax in resutlt ?

if SALIMPARND <= 15000:

resutlt = 0

replace by

if SALIMPARND <= 15000:

result = 0

lyes
On 12/23/14, 6:49 AM

Bonjour

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

#### Med Said BARA

--Med Said BARA--

2739
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 12/21/14, 3:45 AM

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

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

Thank you zbik.

Yes, issue should be reported.

Zbik
on 12/21/14, 3:43 PM

Thank''s zbik

Med Said BARA
on 12/21/14, 5:32 PM

This platform 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.

### Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

2 follower(s)

### Stats

 Asked: 11/25/14, 11:09 AM Seen: 2214 times Last updated: 3/16/15, 8:10 AM