mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-07 04:24:13 +00:00
fix: validation for disabled warehouse
This commit is contained in:
@@ -319,12 +319,13 @@ class StockController(AccountsController):
|
||||
return incoming_rate
|
||||
|
||||
def validate_warehouse(self):
|
||||
from erpnext.stock.utils import validate_warehouse_company
|
||||
from erpnext.stock.utils import validate_warehouse_company, is_disabled_warehouse
|
||||
|
||||
warehouses = list(set([d.warehouse for d in
|
||||
self.get("items") if getattr(d, "warehouse", None)]))
|
||||
|
||||
for w in warehouses:
|
||||
is_disabled_warehouse(w)
|
||||
validate_warehouse_company(w, self.company)
|
||||
|
||||
def update_billing_percentage(self, update_modified=True):
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
import json
|
||||
from frappe.utils import flt, cstr, nowdate, nowtime
|
||||
from frappe.utils import flt, cstr, nowdate, nowtime, get_link_to_form
|
||||
|
||||
from six import string_types
|
||||
|
||||
@@ -279,6 +279,10 @@ def is_group_warehouse(warehouse):
|
||||
if frappe.db.get_value("Warehouse", warehouse, "is_group"):
|
||||
frappe.throw(_("Group node warehouse is not allowed to select for transactions"))
|
||||
|
||||
def is_disabled_warehouse(warehouse):
|
||||
if frappe.db.get_value("Warehouse", warehouse, "disabled"):
|
||||
frappe.throw(_("Disabled Warehouse {0} cannot be used for this transaction.").format(get_link_to_form('Warehouse', warehouse)))
|
||||
|
||||
def update_included_uom_in_report(columns, result, include_uom, conversion_factors):
|
||||
if not include_uom or not conversion_factors:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user