Ignore permissions for account/warehouse creation from Company
This commit is contained in:
parent
18f622f3a9
commit
f169e5c04d
@ -6,7 +6,7 @@ import frappe, os, json
|
|||||||
from frappe.utils import cstr
|
from frappe.utils import cstr
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
|
|
||||||
def create_charts(chart_name, company, ignore_permissions=False):
|
def create_charts(chart_name, company):
|
||||||
chart = get_chart(chart_name)
|
chart = get_chart(chart_name)
|
||||||
|
|
||||||
if chart:
|
if chart:
|
||||||
@ -44,7 +44,7 @@ def create_charts(chart_name, company, ignore_permissions=False):
|
|||||||
if root_account or frappe.local.flags.allow_unverified_charts:
|
if root_account or frappe.local.flags.allow_unverified_charts:
|
||||||
account.flags.ignore_mandatory = True
|
account.flags.ignore_mandatory = True
|
||||||
|
|
||||||
account.flags.ignore_permissions = ignore_permissions
|
account.flags.ignore_permissions = True
|
||||||
|
|
||||||
account.insert()
|
account.insert()
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class Company(Document):
|
|||||||
"company": self.name,
|
"company": self.name,
|
||||||
"create_account_under": stock_group
|
"create_account_under": stock_group
|
||||||
})
|
})
|
||||||
warehouse.flags.ignore_permissions = self.flags.ignore_permissions
|
warehouse.flags.ignore_permissions = True
|
||||||
warehouse.insert()
|
warehouse.insert()
|
||||||
|
|
||||||
def create_default_accounts(self):
|
def create_default_accounts(self):
|
||||||
@ -106,7 +106,7 @@ class Company(Document):
|
|||||||
self.chart_of_accounts = "Standard"
|
self.chart_of_accounts = "Standard"
|
||||||
|
|
||||||
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
|
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
|
||||||
create_charts(self.chart_of_accounts, self.name, self.flags.ignore_permissions)
|
create_charts(self.chart_of_accounts, self.name)
|
||||||
|
|
||||||
frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
|
frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
|
||||||
{"company": self.name, "account_type": "Receivable", "is_group": 0}))
|
{"company": self.name, "account_type": "Receivable", "is_group": 0}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user