From 08b8d3c1801187f7d6ea72f51b3d7fcf1966fbda Mon Sep 17 00:00:00 2001 From: Forlead Date: Fri, 14 Nov 2025 13:36:30 +0000 Subject: [PATCH 1/3] Call calculate_contribution() in Sales Invoice on_update_after_submit --- .../doctype/sales_invoice/sales_invoice.py | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 59ff912e5d..eba9030e08 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -759,25 +759,24 @@ class SalesInvoice(SellingController): data.sales_invoice = sales_invoice def on_update_after_submit(self): - if hasattr(self, "repost_required"): - fields_to_check = [ - "additional_discount_account", - "cash_bank_account", - "account_for_change_amount", - "write_off_account", - "loyalty_redemption_account", - "unrealized_profit_loss_account", - "is_opening", - ] - child_tables = { - "items": ("income_account", "expense_account", "discount_account"), - "taxes": ("account_head",), - } - self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables) - if self.needs_repost: - self.validate_for_repost() - self.db_set("repost_required", self.needs_repost) - self.repost_accounting_entries() + self.calculate_contribution() + fields_to_check = [ + "additional_discount_account", + "cash_bank_account", + "account_for_change_amount", + "write_off_account", + "loyalty_redemption_account", + "unrealized_profit_loss_account", + "is_opening", + ] + child_tables = { + "items": ("income_account", "expense_account", "discount_account"), + "taxes": ("account_head",), + } + self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables) + if self.needs_repost: + self.validate_for_repost() + self.repost_accounting_entries() def set_paid_amount(self): paid_amount = 0.0 -- GitLab From 95c9fa2fa6597e8e65d67594fe43f1817fe4747a Mon Sep 17 00:00:00 2001 From: Forlead Date: Fri, 14 Nov 2025 16:10:35 +0000 Subject: [PATCH 2/3] Call calculate_contribution() in Sales Invoice on_update_after_submit --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index eba9030e08..e3b11a75f1 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -759,7 +759,7 @@ class SalesInvoice(SellingController): data.sales_invoice = sales_invoice def on_update_after_submit(self): - self.calculate_contribution() + self.calculate_contribution() # @dokos fields_to_check = [ "additional_discount_account", "cash_bank_account", -- GitLab From 1d4c2761d662071a0c02ff422d756e385487ec54 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Mon, 17 Nov 2025 16:04:18 +0100 Subject: [PATCH 3/3] fix: merge conflict --- .../doctype/sales_invoice/sales_invoice.py | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index e3b11a75f1..7b49ef7176 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -760,23 +760,25 @@ class SalesInvoice(SellingController): def on_update_after_submit(self): self.calculate_contribution() # @dokos - fields_to_check = [ - "additional_discount_account", - "cash_bank_account", - "account_for_change_amount", - "write_off_account", - "loyalty_redemption_account", - "unrealized_profit_loss_account", - "is_opening", - ] - child_tables = { - "items": ("income_account", "expense_account", "discount_account"), - "taxes": ("account_head",), - } - self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables) - if self.needs_repost: - self.validate_for_repost() - self.repost_accounting_entries() + if hasattr(self, "repost_required"): + fields_to_check = [ + "additional_discount_account", + "cash_bank_account", + "account_for_change_amount", + "write_off_account", + "loyalty_redemption_account", + "unrealized_profit_loss_account", + "is_opening", + ] + child_tables = { + "items": ("income_account", "expense_account", "discount_account"), + "taxes": ("account_head",), + } + self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables) + if self.needs_repost: + self.validate_for_repost() + self.db_set("repost_required", self.needs_repost) + self.repost_accounting_entries() def set_paid_amount(self): paid_amount = 0.0 -- GitLab