[fix] Igonre permissions while saving Company and Warehouse from Accounts Settings
This commit is contained in:
parent
d461d462aa
commit
8db7bd2d8f
@ -16,7 +16,9 @@ class AccountsSettings(Document):
|
||||
if cint(self.auto_accounting_for_stock):
|
||||
# set default perpetual account in company
|
||||
for company in frappe.db.sql("select name from tabCompany"):
|
||||
frappe.get_doc("Company", company[0]).save()
|
||||
company = frappe.get_doc("Company", company[0])
|
||||
company.flags.ignore_permissions = True
|
||||
company.save()
|
||||
|
||||
# Create account head for warehouses
|
||||
warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
|
||||
@ -25,4 +27,5 @@ class AccountsSettings(Document):
|
||||
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
|
||||
wh_doc.save()
|
||||
|
Loading…
x
Reference in New Issue
Block a user