[domainify] patch to set the restrict to domain for module_def (#9912)

This commit is contained in:
Makarand Bauskar 2017-07-18 12:30:57 +05:30 committed by GitHub
parent 4a10f18ee3
commit 6e30f04181
6 changed files with 729 additions and 689 deletions

View File

@ -419,5 +419,6 @@ erpnext.patches.v8_1.add_hsn_sac_codes
erpnext.patches.v8_1.update_gst_state #17-07-2017
erpnext.patches.v8_1.removed_report_support_hours
erpnext.patches.v8_1.add_indexes_in_transaction_doctypes
erpnext.patches.v8_3.set_restrict_to_domain_for_module_def
erpnext.patches.v8_1.update_expense_claim_status
erpnext.patches.v8_3.update_company_total_sales

View File

@ -0,0 +1,13 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.setup.setup_wizard.domainify import update_module_def_restrict_to_domain
def execute():
""" set the restrict to domain in module def """
frappe.reload_doc("core", "doctype", "module_def")
update_module_def_restrict_to_domain()

View File

@ -25,7 +25,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Academic Year",
"length": 0,
@ -148,7 +148,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Program",
"length": 0,
@ -269,7 +269,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-05-15 12:43:32.317942",
"modified": "2017-07-17 21:57:35.602091",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Group Creation Tool",
@ -300,6 +300,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "SLA.######",
@ -13,6 +14,7 @@
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -43,6 +45,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -73,6 +76,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -102,6 +106,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -131,6 +136,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -160,6 +166,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -190,6 +197,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -218,6 +226,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -247,6 +256,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -276,17 +286,17 @@
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-02-20 13:21:08.828872",
"modified": "2017-07-17 21:57:57.804413",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Leave Application",
@ -337,6 +347,7 @@
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -359,7 +359,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-07-06 12:42:05.777673",
"modified": "2017-07-17 21:57:11.024049",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Log",
@ -390,6 +390,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
def get_domain(domain):
'''Written as a function to prevent data mutation effects'''
@ -78,8 +79,11 @@ def setup_domain(domain):
setup_properties(data)
set_values(data)
setup_sidebar_items(data)
update_module_def_restrict_to_domain()
if data.get('default_portal_role'):
frappe.db.set_value('Portal Settings', None, 'default_role', data.get('default_portal_role'))
frappe.clear_cache()
def setup_desktop_icons(data):
@ -137,9 +141,18 @@ def setup_sidebar_items(data):
frappe.db.sql('''update `tabPortal Menu Item` set enabled=0
where route in ({0})'''.format(', '.join(['"{0}"'.format(d) for d in data.remove_sidebar_items])))
def reset():
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
add_all_roles_to('Administrator')
frappe.db.sql('delete from `tabProperty Setter`')
def update_module_def_restrict_to_domain():
""" set the restrict to domain for the module def """
module_def_restrict_to_domain_mapper = {
"Schools": _('Education')
}
for module, domain in module_def_restrict_to_domain_mapper.iteritems():
frappe.set_value("Module Def", module, "restrict_to_domain", domain)