Store cache in one save

issue6980
review44471002
This commit is contained in:
Cédric Krier committed 2017-12-13 18:02:12 +01:00
1 parent ebec4dcc5c
commit aadc9da5da
1 file changed
+4 -5
+4 -5
View File
@@ -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'