cr.fetchall() can't get a value of a stored function in the database
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When we herit from hr_payroll module I encounter a bug, please follow me :
class hr_payslip(
_inherit = 'hr.payslip'
def _compute_
if not context : context = {}
res = {}
for slip in self.browse(cr, uid, ids, context=context) :
sb = 0.0
for line in slip.line_ids :
}
return res
_columns = {
'sb_val': fields.
}
hr_payslip()
When I compute the payslip I get 10 lines with the sum = 23400 but 'sb_val' equal 0 <-- This is the problem, sb_val must equal 23400 not 0
When I edit code, modfying sb += line.total to sb += 3 I get 30 so there is an interfernce that prevent the calcul and this is a bug because the field total in the object hr.payslip.line is a stored function
Changed in openobject-addons: | |
status: | Expired → Invalid |
Hello Yug,
When you use the store="True" on function field the value will be stored on database. So it will fetch the value which exists on database, it doesn't update the value after that only update when function will execute.
Would you please try without store="True", or let you know what you want to try.
Thank you!