コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
10208 ビュー

Hi

I need a trigger value,

cost_store_triggers = {'product.product':(_get_replace_cost, ['cost'], 5)}

In that case I need a recomputed value for all related (parent and child product cost) product cost so I used this trigger, but it's not working.

Cost = fields. Float (string='Cost', compute=_get_replace_cost, store=cost_store_triggers)

アバター
破棄
最善の回答

Hi,

you can use @api.depends() for this : specify the field dependencies; those dependencies are used to determine when to recompute the field; recomputation is automatic and guarantees cache/database consistency. Note that the same method can be used for several fields, you simply have to assign all the given fields in the method; the method will be invoked once for all those fields.

 @api.depends('field1', 'field2')

Hope this helps.



アバター
破棄