mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-30 02:14:48 +00:00
Company mandatory validation while enabling perpetual inventory
This commit is contained in:
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import cint, cstr
|
from webnotes import _
|
||||||
from webnotes import msgprint, _
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
@@ -16,6 +15,11 @@ class DocType:
|
|||||||
webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
|
webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
|
||||||
|
|
||||||
if self.doc.auto_accounting_for_stock:
|
if self.doc.auto_accounting_for_stock:
|
||||||
for wh in webnotes.conn.sql("select name from `tabWarehouse`"):
|
warehouse_list = webnotes.conn.sql("select name, company from tabWarehouse", as_dict=1)
|
||||||
wh_bean = webnotes.bean("Warehouse", wh[0])
|
warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
|
||||||
|
if warehouse_with_no_company:
|
||||||
|
webnotes.throw(_("Company is missing in following warehouses") + ": \n" +
|
||||||
|
"\n".join(warehouse_with_no_company))
|
||||||
|
for wh in warehouse_list:
|
||||||
|
wh_bean = webnotes.bean("Warehouse", wh.name)
|
||||||
wh_bean.save()
|
wh_bean.save()
|
||||||
Reference in New Issue
Block a user