From 2a7867511d8e1da3d0fae7268fefe7888a2ba8c5 Mon Sep 17 00:00:00 2001 From: Diptanil Saha Date: Wed, 27 May 2026 01:43:40 +0530 Subject: [PATCH] fix(sales_invoice): skip stock update for POS invoices linked to Delivery Note (#55311) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 86f84be0973..634e97aa9b5 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -969,9 +969,6 @@ class SalesInvoice(SellingController): if selling_price_list: self.set("selling_price_list", selling_price_list) - if not for_validate: - self.update_stock = cint(pos.get("update_stock")) - # set pos values in items for item in self.get("items"): if item.get("item_code"): @@ -982,6 +979,10 @@ class SalesInvoice(SellingController): if (not for_validate) or (for_validate and not item.get(fname)): item.set(fname, val) + if not for_validate: + dn_flag = any(d.get("dn_detail") for d in self.get("items")) + self.update_stock = 0 if dn_flag else cint(pos.get("update_stock")) + # fetch terms if self.tc_name and not self.terms: self.terms = frappe.db.get_value("Terms and Conditions", self.tc_name, "terms")