From cd7e1bbff1d08b2a82249913867078efbc29ef6d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 20:32:53 +0000 Subject: [PATCH] fix(sales_invoice): skip stock update for POS invoices linked to Delivery Note (backport #55311) (#55313) Co-authored-by: Diptanil Saha 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 ef64a3ef79b..8a7648d20d8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -968,9 +968,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"): @@ -981,6 +978,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")