Ignore permissions for account/warehouse creation from Company

This commit is contained in:
Nabin Hait 2016-05-30 12:15:27 +05:30
parent 18f622f3a9
commit f169e5c04d
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import frappe, os, json
from frappe.utils import cstr
from unidecode import unidecode
def create_charts(chart_name, company, ignore_permissions=False):
def create_charts(chart_name, company):
chart = get_chart(chart_name)
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:
account.flags.ignore_mandatory = True
account.flags.ignore_permissions = ignore_permissions
account.flags.ignore_permissions = True
account.insert()

View File

@ -98,7 +98,7 @@ class Company(Document):
"company": self.name,
"create_account_under": stock_group
})
warehouse.flags.ignore_permissions = self.flags.ignore_permissions
warehouse.flags.ignore_permissions = True
warehouse.insert()
def create_default_accounts(self):
@ -106,7 +106,7 @@ class Company(Document):
self.chart_of_accounts = "Standard"
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",
{"company": self.name, "account_type": "Receivable", "is_group": 0}))