Browse Source

[IMP] cpo: store total_amount (performance)

pull/145/head
robin.keunen 6 years ago
parent
commit
8776fb2242
  1. 5
      compute_purchase_order/models/computed_purchase_order.py

5
compute_purchase_order/models/computed_purchase_order.py

@ -36,7 +36,8 @@ class ComputedPurchaseOrder(models.Model):
total_amount = fields.Float( total_amount = fields.Float(
string='Total Amount (w/o VAT)', string='Total Amount (w/o VAT)',
compute='_compute_cpo_total'
compute='_compute_cpo_total',
store=True,
) )
generated_purchase_order_ids = fields.One2many( generated_purchase_order_ids = fields.One2many(
@ -142,7 +143,7 @@ class ComputedPurchaseOrder(models.Model):
} }
return action return action
# @api.onchange(order_line_ids) # fixme
@api.depends('order_line_ids.subtotal')
@api.multi @api.multi
def _compute_cpo_total(self): def _compute_cpo_total(self):
for cpo in self: for cpo in self:

Loading…
Cancel
Save