From aadc9da5da3ce6713bdc5518789fc236505b83fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 13 Dec 2017 18:02:12 +0100 Subject: [PATCH] Store cache in one save issue6980 review44471002 --- purchase.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/purchase.py b/purchase.py index ca1d9c0ac6..e8e88addeb 100644 --- a/purchase.py +++ b/purchase.py @@ -664,11 +664,10 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin): @classmethod def store_cache(cls, purchases): for purchase in purchases: - cls.write([purchase], { - 'untaxed_amount_cache': purchase.untaxed_amount, - 'tax_amount_cache': purchase.tax_amount, - 'total_amount_cache': purchase.total_amount, - }) + purchase.untaxed_amount_cache = purchase.untaxed_amount + purchase.tax_amount_cache = purchase.tax_amount + purchase.total_amount_cache = purchase.total_amount + cls.save(purchases) def _get_invoice_purchase(self): 'Return invoice'