fix: validation for disabled warehouse

This commit is contained in:
pateljannat
2021-02-03 15:34:57 +05:30
parent d3240f9510
commit 469827da85
2 changed files with 7 additions and 2 deletions

View File

@@ -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):

View File

@@ -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