mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-02 16:13:22 +00:00
refactor: move warehouse defaults from Stock Settings to Company
Default Warehouse and Sample Retention Warehouse were global singles, so every consumer had to re-check that the warehouse belonged to the transaction's company before using it. Both now live on Company, under a new Warehouse Defaults section that also collects the warehouse fields Company already had. The company check moves to Company.validate_warehouses, which also rejects group warehouses for all seven fields — a group or cross-company value there already failed at SLE time, this just surfaces it at the source. New companies get their Stores warehouse as Default Warehouse via create_default_warehouses, replacing the setup-wizard and test-fixture code that seeded the global.
This commit is contained in:
@@ -911,8 +911,8 @@ class SellingController(StockController):
|
||||
if self.get("is_return"):
|
||||
return
|
||||
|
||||
sample_retention_warehouse = frappe.db.get_single_value(
|
||||
"Stock Settings", "sample_retention_warehouse"
|
||||
sample_retention_warehouse = frappe.get_cached_value(
|
||||
"Company", self.company, "sample_retention_warehouse"
|
||||
)
|
||||
if not sample_retention_warehouse:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user