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

Closes #13296
This commit is contained in:
Cédric Krier
2024-06-13 12:34:50 +02:00
parent 09985de225
commit 376dbeddb5
3 changed files with 15 additions and 3 deletions
+5 -1
View File
@@ -890,7 +890,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
@@ -351,7 +351,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
@@ -1026,7 +1026,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