I have a list of fields updated by a method:
wt = self.env['divina.custos']
wt.browse(curr_day).write({'day_costs': costs_d, 'month_costs': costs_m, 'day_sold': tot_val_d,
'month_sold':tot_val_m,'month_profit': profit_month, 'ord_proc': ord_proc,
'day_profit': profit_day})
self.env.cr.commit()
self.env.invalidate_all()
First of all, without invalidate the cache after the write I always get an error.
Secondly, the field day_profit is always 0.0 (null) but all the other fields are correctly updated.
I need to add a second write statement after the first batch
wt.browse(curr_day).write({'day_profit': profit_day})
to make it work, and I don't understand why.
The variable is populated in the same part of the function where all the variables were declared, and _logger.info() clearly show it with the correct value on the log right after the self.write.
What I'm doing wrong?
The variable is populated in the same part of the function where all the variables were declared, and _logger.info() clearly show it with the correct value on the log right after the self.write.
What I'm doing wrong?