跳至内容
菜单
此问题已终结
3241 查看

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?
形象
丢弃
相关帖文 回复 查看 活动
1
2月 17
7381
1
3月 17
12197
5
7月 20
9117
1
12月 19
6036
2
7月 25
4656