This question has been flagged
4 Replies
5983 Views

Hi,

When I use : worked_days.Unpaid.number_of_days I obtain an error because code python is wrong.

I need an extra module or the variable is wrong?

Where I can find the variables?

Thanks in advance,

Eduardo

 

 

Avatar
Discard

Hi,, Can you please add more details??

Hi I am using OPENERP 7.

The condition rule is always true ( for testing) if I use "result=worked_days.Unpaid and worked_days.Unpaid.number_of_days or False" nothing is calculated.

the python code for computation is:

result=-(contract.wage/30)*worked_days.Unpaid.number_of_days

the employees has 5 days of leaves.

when I run payslip batches for the employees I get the error python code is wrong.
thanks,
Eduardo

2015-02-27 9:16 GMT-05:00 Baiju KS <baijuks@hotmail.com>:

Hi,, Can you please add more details??

--
Baiju KS
Sent by Odoo S.A. using Odoo about Forum Post "worked_days.Unpaid.number_of_days" not working

Best Answer

hay I have got the same error and i try solve more than  a day finaly i solved like this please Tryyyy

///////////////////////////

if worked_days.GLOBAL and worked_days.GLOBAL.number_of_days or False:

result=contract.wage - ((contract.wage / 30) *worked_days.GLOBAL.number_of_days)

else:

result=contract.wage


///////////////////////////////////////////

Avatar
Discard
Best Answer

I have the same problem, did you manage to find a solution ?

Thanks in advance

Avatar
Discard
Best Answer

Any one got the solution?
I am also facing the same problem since yesterday 

Avatar
Discard
Best Answer


I have the same problem when using python code:

result=(contract.wage/31)*worked_days.Unpaid.number_of_days

and tried with or with or without condition:

result=worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

 

I'm using Odoo 8 and this is my log when trying to calculate. Maybe a language problem? Aparently other people didn't have any problem using this formulas, and eduardo and i use spanish language.

2

2015-06-04 16:26:08,929 22244 ERROR nuevabase2 openerp.http: Exception during JSON request handling.

Traceback (most recent call last):

File "/opt/odoo/server/openerp/http.py", line 536, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/opt/odoo/server/openerp/http.py", line 573, in dispatch

result = self._call_function(**self.params)

File "/opt/odoo/server/openerp/http.py", line 309, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/opt/odoo/server/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/opt/odoo/server/openerp/http.py", line 306, in checked_call

return self.endpoint(*a, **kw)

File "/opt/odoo/server/openerp/http.py", line 802, in __call__

return self.method(*args, **kw)

File "/opt/odoo/server/openerp/http.py", line 402, in response_wrap

response = f(*args, **kw)

File "/opt/odoo/server/addons/web/controllers/main.py", line 941, in call_button

action = self._call_kw(model, method, args, {})

File "/opt/odoo/server/addons/web/controllers/main.py", line 929, in _call_kw

return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

File "/opt/odoo/server/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/server/addons/hr_payroll/hr_payroll.py", line 391, in compute_sheet

lines = [(0,0,line) for line in self.pool.get('hr.payslip').get_payslip_lines(cr, uid, contract_ids, payslip.id, context=context)]

File "/opt/odoo/server/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/server/addons/hr_payroll/hr_payroll.py", line 581, in get_payslip_lines

amount, qty, rate = obj_rule.compute_rule(cr, uid, rule.id, localdict, context=context)

File "/opt/odoo/server/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/server/addons/hr_payroll/hr_payroll.py", line 863, in compute_rule

raise osv.except_osv(_('Error!'), _('Wrong python code defined for salary rule %s (%s).')% (rule.name, rule.code))

except_orm: (u'\xa1Error!', u'C\xf3digo python err\xf3neo en la regla de salario Faltas sin Aviso (0105).')

2015-06-04 16:26:08,932 22244 INFO nuevabase2 werkzeug: 192.168.1.120 - - [04/Jun/2015 16:26:08] "POST /web/dataset/call_button HTTP/1.1" 200 -

2015-06-04 16:26:09,397 22244 INFO nuevabase2 werkzeug: 192.168.1.120 - - [04/Jun/2015 16:26:09] "POST /web/dataset/search_read HTTP/1.1" 200 -

Avatar
Discard