I have something like this in a wizard:
class SaleOrderLine():
_inherit = 'sale.order.line'
boolean_field = fields.Boolean(compute='_compute_boolean_field', store=True)
@api.depends('product_id', 'qty')
def _compute_boolean_field(self):
self.flush_recordset()
# execute query that uses the each recordset's product_id qty
# loop and update boolean_field
My issue is when I'm updating sale.order.line from the parent(sale.order) in the UI, the query does not work with my recent change to product_id and so the boolean_field computation is wrong despite flush_recordset()(and all other forms of flushes even self.env.cr.commit()).
How do I force the UI changes on sale.order.line to the database before the user saves the record so the query works as expected?
คำถามนี้ถูกตั้งค่าสถานะ
1
ตอบกลับ
2833
มุมมอง
For anyone in the same situation.
if self._origin:
self._origin.write(vals).
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|
|
0
ธ.ค. 24
|
2998 | ||
|
|
1
พ.ค. 24
|
4755 | ||
|
|
1
ม.ค. 24
|
2980 | ||
|
How can I get ID of New record?
แก้ไขแล้ว
|
|
2
ธ.ค. 24
|
17402 | |
|
|
0
ก.พ. 19
|
3910 |