fix: purchase invoice for internal transfers should not require PO (backport #53791) (#53793)

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
fix: purchase invoice for internal transfers should not require PO (#53791)
This commit is contained in:
mergify[bot]
2026-03-26 04:24:43 +05:30
committed by GitHub
parent 737cb371d7
commit 72efbc2b42

View File

@@ -617,12 +617,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_single_value("Buying Settings", "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.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))