From 2af5a05ebcf3f2ed7913aa658cafcda6b2b86b34 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Tue, 21 Jan 2025 10:09:29 +0100 Subject: [PATCH] fix: Allow down payment return --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 1 + erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 139c015d7a..90faa667df 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -227,6 +227,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends ( "To reconcile this credit note with sales invoice {0}, use the {1} dashboard", [doc.return_against, pr_dashboard] ); + me.frm.dashboard.clear_headline(); me.frm.dashboard.set_headline(msg, "blue"); } }); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index e6a06b2049..b1c34094c6 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1469,7 +1469,7 @@ class SalesInvoice(SellingController): item=item, ) - if self.is_down_payment_invoice: + if self.is_down_payment_invoice or self.is_down_payment_return(): gl_dict.update({"party_type": "Customer", "party": self.customer}) gl_entries.append(gl_dict) @@ -1478,6 +1478,13 @@ class SalesInvoice(SellingController): if cint(self.update_stock) and erpnext.is_perpetual_inventory_enabled(self.company): gl_entries += super().get_gl_entries() + def is_down_payment_return(self): + return ( + self.is_return + and self.return_against + and frappe.db.get_value("Sales Invoice", self.return_against, "is_down_payment_invoice") + ) + def get_asset(self, item): if item.get("asset"): asset = frappe.get_doc("Asset", item.asset) -- GitLab