fix: Recalculate sales commission on item update

(cherry picked from commit f76da50b7e)
This commit is contained in:
Deepesh Garg
2024-03-29 17:57:58 +05:30
committed by Mergify
parent 3971ff5f72
commit 5117494a52
3 changed files with 5 additions and 2 deletions

View File

@@ -139,7 +139,7 @@ class SellingController(StockController):
self.in_words = money_in_words(amount, self.currency)
def calculate_commission(self):
if not self.meta.get_field("commission_rate") or self.docstatus.is_submitted():
if not self.meta.get_field("commission_rate"):
return
self.round_floats_in(self, ("amount_eligible_for_commission", "commission_rate"))

View File

@@ -1529,6 +1529,7 @@
"read_only": 1
},
{
"allow_on_submit": 1,
"fieldname": "amount_eligible_for_commission",
"fieldtype": "Currency",
"label": "Amount Eligible for Commission",
@@ -1644,7 +1645,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2024-03-20 16:04:43.627183",
"modified": "2024-03-29 16:27:41.539613",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@@ -517,6 +517,8 @@ class SalesOrder(SellingController):
pass
def on_update_after_submit(self):
self.calculate_commission()
self.calculate_contribution()
self.check_credit_limit()
def before_update_after_submit(self):