test: stop relying on companies having no default warehouse

Companies now get their Stores warehouse as Default Warehouse, so item
warehouse resolution succeeds where it previously came back empty.

test_internal_pr_reference cleared inter_company_reference and asserted a
ValidationError, but no validation covers that field - the mapper already
sets it. It was incidentally catching 'Row #1: Warehouse is mandatory for
stock Item' from the blank target warehouse, so the assertion never tested
what it claimed. Dropped it; the delivery_note_item assertion below still
covers the reference linkage.

test_inter_company_transaction_without_default_warehouse now establishes its
own premise by clearing the company's default warehouse instead of relying
on it being unset. Its failure previously skipped the teardown that restores
frappe.local.enable_perpetual_inventory, which db rollback cannot undo, which
in turn broke two later inter-company tests.
This commit is contained in:
Mihir Kandoi
2026-07-28 20:06:47 +05:30
parent 455251abe1
commit ac477bb33c
2 changed files with 4 additions and 3 deletions

View File

@@ -3215,6 +3215,10 @@ class TestSalesInvoice(ERPNextTestSuite):
"Stock Received But Not Billed - _TC1",
)
# companies are created with their Stores warehouse as Default Warehouse; clear it so the
# item genuinely maps without one
frappe.db.set_value("Company", "_Test Company 1", "default_warehouse", None)
# begin test
si = create_sales_invoice(
company="Wind Power LLC",

View File

@@ -2395,9 +2395,6 @@ class TestPurchaseReceipt(ERPNextTestSuite):
from erpnext.stock.doctype.delivery_note.mapper import make_inter_company_purchase_receipt
pr = make_inter_company_purchase_receipt(dn.name)
pr.inter_company_reference = ""
self.assertRaises(frappe.ValidationError, pr.save)
pr.inter_company_reference = dn.name
pr.items[0].qty = 10
pr.items[0].from_warehouse = target_warehouse