On saving of Accounts Settings, only save enabled warehouses (#8772)
This commit is contained in:
parent
62d27ab7d3
commit
5ad6126832
@ -188,9 +188,9 @@ class Account(Document):
|
||||
account_balance = get_balance_on(self.name)
|
||||
|
||||
if account_balance != stock_balance:
|
||||
frappe.throw(_('Account balance ({0}) and stock value ({1}) must be same')\
|
||||
.format(fmt_money(account_balance, currency=self.account_currency),
|
||||
fmt_money(stock_balance, currency=self.account_currency)))
|
||||
frappe.throw(_('Account balance ({0}) for {1} and stock value ({2}) for warehouse {3} must be same')
|
||||
.format(fmt_money(account_balance, currency=self.account_currency), self.name,
|
||||
fmt_money(stock_balance, currency=self.account_currency), self.warehouse))
|
||||
|
||||
elif self.warehouse:
|
||||
self.warehouse = None
|
||||
|
@ -21,10 +21,13 @@ class AccountsSettings(Document):
|
||||
company.save()
|
||||
|
||||
# Create account head for warehouses
|
||||
warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
|
||||
warehouse_list = frappe.db.sql("""select name, company from tabWarehouse
|
||||
where disabled=0""", as_dict=1)
|
||||
warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
|
||||
if warehouse_with_no_company:
|
||||
frappe.throw(_("Company is missing in warehouses {0}").format(comma_and(warehouse_with_no_company)))
|
||||
frappe.throw(_("Company is missing in warehouses {0}")
|
||||
.format(comma_and(warehouse_with_no_company)))
|
||||
|
||||
for wh in warehouse_list:
|
||||
wh_doc = frappe.get_doc("Warehouse", wh.name)
|
||||
wh_doc.flags.ignore_permissions = True
|
||||
|
Loading…
Reference in New Issue
Block a user