Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3237 Lượt xem

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?
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 17
7379
1
thg 3 17
12194
5
thg 7 20
9111
1
thg 12 19
6036
2
thg 7 25
4651