Merge branch 'pratu16x7-domainify' into domainify (#9324)
* bootstrap domains and set active_domain on setup * [minor] Patch for domain docs * [minor] * Update create_domain_docs.py
This commit is contained in:
parent
2510d1c86a
commit
dd986f659e
@ -402,4 +402,5 @@ erpnext.patches.v8_0.update_customer_pos_id
|
|||||||
erpnext.patches.v8_0.rename_items_in_status_field_of_material_request
|
erpnext.patches.v8_0.rename_items_in_status_field_of_material_request
|
||||||
erpnext.patches.v8_0.delete_bin_indexes
|
erpnext.patches.v8_0.delete_bin_indexes
|
||||||
erpnext.patches.v8_0.move_account_head_from_account_to_warehouse_for_inventory
|
erpnext.patches.v8_0.move_account_head_from_account_to_warehouse_for_inventory
|
||||||
erpnext.patches.v8_0.change_in_words_varchar_length
|
erpnext.patches.v8_0.change_in_words_varchar_length
|
||||||
|
erpnext.patches.v8_0.create_domain_docs
|
41
erpnext/patches/v8_0/create_domain_docs.py
Normal file
41
erpnext/patches/v8_0/create_domain_docs.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
import erpnext
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
"""Create domain documents"""
|
||||||
|
|
||||||
|
for domain in ("Distribution", "Manufacturing", "Retail", "Services", "Education"):
|
||||||
|
if not frappe.db.exists({'doctype': 'Domain', 'domain': domain}):
|
||||||
|
doc = frappe.new_doc("Domain")
|
||||||
|
doc.domain = domain
|
||||||
|
doc.save()
|
||||||
|
|
||||||
|
|
||||||
|
# set domain in domain settings based on company domain
|
||||||
|
|
||||||
|
domains = []
|
||||||
|
condition = ""
|
||||||
|
company = erpnext.get_default_company()
|
||||||
|
if company:
|
||||||
|
condition = " where name='{0}'".format(company)
|
||||||
|
|
||||||
|
domains = frappe.db.sql_list("select distinct domain from `tabCompany` {0}".format(condition))
|
||||||
|
|
||||||
|
if not domains:
|
||||||
|
return
|
||||||
|
|
||||||
|
domain_settings = frappe.get_doc("Domain Settings", "Domain Settings")
|
||||||
|
checked_domains = [row.domain for row in domain_settings.active_domains]
|
||||||
|
|
||||||
|
for domain in domains:
|
||||||
|
# check and ignore if the domains is already checked in domain settings
|
||||||
|
if domain in checked_domains:
|
||||||
|
continue
|
||||||
|
|
||||||
|
row = domain_settings.append("active_domains", dict(domain=args.domain))
|
||||||
|
|
||||||
|
domain_settings.save(ignore_permissions=True)
|
@ -105,8 +105,9 @@ def setup_roles(data):
|
|||||||
|
|
||||||
if data.allow_roles:
|
if data.allow_roles:
|
||||||
# remove all roles other than allowed roles
|
# remove all roles other than allowed roles
|
||||||
|
active_domains = frappe.get_active_domains()
|
||||||
data.allow_roles += ['Administrator', 'Guest', 'System Manager', 'All']
|
data.allow_roles += ['Administrator', 'Guest', 'System Manager', 'All']
|
||||||
for role in frappe.get_all('Role'):
|
for role in frappe.get_all('Role', filters = {"restrict_to_domain": ("not in", active_domains)}):
|
||||||
if not (role.name in data.allow_roles):
|
if not (role.name in data.allow_roles):
|
||||||
remove_role(role.name)
|
remove_role(role.name)
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@ default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
|
|||||||
|
|
||||||
def install(country=None):
|
def install(country=None):
|
||||||
records = [
|
records = [
|
||||||
|
# domains
|
||||||
|
{ 'doctype': 'Domain', 'domain': _('Distribution')},
|
||||||
|
{ 'doctype': 'Domain', 'domain': _('Manufacturing')},
|
||||||
|
{ 'doctype': 'Domain', 'domain': _('Retail')},
|
||||||
|
{ 'doctype': 'Domain', 'domain': _('Services')},
|
||||||
|
{ 'doctype': 'Domain', 'domain': _('Education')},
|
||||||
|
|
||||||
# address template
|
# address template
|
||||||
{'doctype':"Address Template", "country": country},
|
{'doctype':"Address Template", "country": country},
|
||||||
|
|
||||||
@ -35,7 +42,7 @@ def install(country=None):
|
|||||||
{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic'), 'type': 'Earning'},
|
{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic'), 'type': 'Earning'},
|
||||||
{'doctype': 'Salary Component', 'salary_component': _('Arrear'), 'description': _('Arrear'), 'type': 'Earning'},
|
{'doctype': 'Salary Component', 'salary_component': _('Arrear'), 'description': _('Arrear'), 'type': 'Earning'},
|
||||||
{'doctype': 'Salary Component', 'salary_component': _('Leave Encashment'), 'description': _('Leave Encashment'), 'type': 'Earning'},
|
{'doctype': 'Salary Component', 'salary_component': _('Leave Encashment'), 'description': _('Leave Encashment'), 'type': 'Earning'},
|
||||||
|
|
||||||
|
|
||||||
# expense claim type
|
# expense claim type
|
||||||
{'doctype': 'Expense Claim Type', 'name': _('Calls'), 'expense_type': _('Calls')},
|
{'doctype': 'Expense Claim Type', 'name': _('Calls'), 'expense_type': _('Calls')},
|
||||||
@ -197,7 +204,7 @@ def install(country=None):
|
|||||||
# Assessment Group
|
# Assessment Group
|
||||||
{'doctype': 'Assessment Group', 'assessment_group_name': _('All Assessment Groups'),
|
{'doctype': 'Assessment Group', 'assessment_group_name': _('All Assessment Groups'),
|
||||||
'is_group': 1, 'parent_assessment_group': ''},
|
'is_group': 1, 'parent_assessment_group': ''},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
from erpnext.setup.setup_wizard.industry_type import get_industry_types
|
from erpnext.setup.setup_wizard.industry_type import get_industry_types
|
||||||
|
@ -198,6 +198,10 @@ def set_defaults(args):
|
|||||||
hr_settings.emp_created_by = "Naming Series"
|
hr_settings.emp_created_by = "Naming Series"
|
||||||
hr_settings.save()
|
hr_settings.save()
|
||||||
|
|
||||||
|
domain_settings = frappe.get_doc("Domain Settings")
|
||||||
|
domain_settings.append('active_domain', dict(domain=args.domain))
|
||||||
|
domain_settings.save()
|
||||||
|
|
||||||
def create_feed_and_todo():
|
def create_feed_and_todo():
|
||||||
"""update Activity feed and create todo for creation of item, customer, vendor"""
|
"""update Activity feed and create todo for creation of item, customer, vendor"""
|
||||||
add_info_comment(**{
|
add_info_comment(**{
|
||||||
|
Loading…
Reference in New Issue
Block a user