【发布时间】:2020-10-14 11:33:02
【问题描述】:
我想更新现有记录的“on_hand_qty”字段
_inherit="product.product"
on_hand_qty=fields.Float('onhand', compute='copy_quant' ,store=True)
@api.constrains('qty_available')
def copy_quant(self):
for rec in self:
rec.on_hand_qty = rec.qty_available
我希望这个字段带有 store =True 但此字段在 store=True 的旧记录中未更新。请建议如何实现这一目标。
【问题讨论】:
-
为什么使用
api.constrains而不是api.depends作为装饰器?
标签: python xml odoo odoo-10 calculated-columns