From e136ba0764f7a8e83bfba0f1b1532d00159c57a9 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Fri, 10 May 2019 14:08:31 +0200 Subject: [PATCH] [IMP] cpo: store total_amount (performance) --- compute_purchase_order/models/computed_purchase_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compute_purchase_order/models/computed_purchase_order.py b/compute_purchase_order/models/computed_purchase_order.py index 87973b8..6ce507d 100644 --- a/compute_purchase_order/models/computed_purchase_order.py +++ b/compute_purchase_order/models/computed_purchase_order.py @@ -36,7 +36,8 @@ class ComputedPurchaseOrder(models.Model): total_amount = fields.Float( string='Total Amount (w/o VAT)', - compute='_compute_cpo_total' + compute='_compute_cpo_total', + store=True, ) generated_purchase_order_ids = fields.One2many( @@ -142,7 +143,7 @@ class ComputedPurchaseOrder(models.Model): } return action - # @api.onchange(order_line_ids) # fixme + @api.depends('order_line_ids.subtotal') @api.multi def _compute_cpo_total(self): for cpo in self: