Clear cached amount when resetting to draft sale, purchase and purchase requisition

Closes #13296
(grafted from 8e441329d11b93ceafa47d553cb23883e5b4ec2f)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2024-06-13 12:34:50 +02:00
parent 23f4232157
commit 6377c401db
3 changed files with 15 additions and 3 deletions
+5 -1
View File
@@ -867,7 +867,11 @@ class Purchase(
@Workflow.transition('draft')
@reset_employee('quoted_by', 'confirmed_by')
def draft(cls, purchases):
pass
cls.write(purchases, {
'tax_amount_cache': None,
'untaxed_amount_cache': None,
'total_amount_cache': None,
})
@classmethod
@ModelView.button
+5 -1
View File
@@ -344,7 +344,11 @@ class PurchaseRequisition(Workflow, ModelSQL, ModelView):
@Workflow.transition('draft')
@reset_employee('approved_by', 'rejected_by')
def draft(cls, requisitions):
pass
cls.write(requisitions, {
'tax_amount_cache': None,
'untaxed_amount_cache': None,
'total_amount_cache': None,
})
@classmethod
@ModelView.button
+5 -1
View File
@@ -1001,7 +1001,11 @@ class Sale(
@Workflow.transition('draft')
@reset_employee('quoted_by', 'confirmed_by')
def draft(cls, sales):
pass
cls.write(sales, {
'tax_amount_cache': None,
'untaxed_amount_cache': None,
'total_amount_cache': None,
})
@classmethod
@ModelView.button