Hello Friend,
I have encounter the following code in payroll odoo apps:
How do I extract the worked_days.number_of_hours from localdict and store it in localdict['result_qty']
so i can use it from which it was called from.
Hope for your kindness.
regards,
Gain
Odoo Users
-----------------------------------------------------------
class HrSalaryRule(models.Model):
_inherit = 'hr.salary.rule'
@api.multi
def _compute_rule(self, localdict):
"""
:param localdict: dictionary containing the environement in which to compute the rule
:return: returns a tuple build as the base/amount computed, the quantity and the rate
:rtype: (float, float, float)
"""
self.ensure_one()
try:
safe_eval(self.amount_python_compute, localdict, mode='exec', nocopy=True)
return float(localdict['result']), 'result_qty' in localdict and localdict['result_qty'] or 1.0, 'result_rate' in localdict and localdict['result_rate'] or 100.0