From 0a28fb3ae1c81910aae2e18b193042928c823f5f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 03:45:18 +0000 Subject: [PATCH] fix: purchase invoice for internal transfers should not require PO (backport #53791) (#53792) * fix: purchase invoice for internal transfers should not require PO (#53791) (cherry picked from commit 3f74733942ed55db7ff72343ad260811f7f755f8) # Conflicts: # erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py * chore: resolve conflicts --------- Co-authored-by: Mihir Kandoi --- .../doctype/purchase_invoice/purchase_invoice.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index a8e073c353c..ea513e0cfd7 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -612,12 +612,13 @@ class PurchaseInvoice(BuyingController): frappe.db.set_value(self.doctype, self.name, "against_expense_account", self.against_expense_account) def po_required(self): - if frappe.db.get_value("Buying Settings", None, "po_required") == "Yes": - if frappe.get_value( + if ( + frappe.db.get_single_value("Buying Settings", "po_required") == "Yes" + and not self.is_internal_transfer() + and not frappe.db.get_value( "Supplier", self.supplier, "allow_purchase_invoice_creation_without_purchase_order" - ): - return - + ) + ): for d in self.get("items"): if not d.purchase_order: msg = _("Purchase Order Required for item {}").format(frappe.bold(d.item_code))