[fix] use get_domains to prevent mutation of nested dictionary

This commit is contained in:
Anand Doshi 2016-06-28 21:37:28 +05:30
parent c8d86cb948
commit 0e4119b2de

View File

@ -4,7 +4,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
domains = { def get_domains():
'''Written as a function to prevent data mutation effects'''
return {
'Manufacturing': { 'Manufacturing': {
'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order', 'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
'Production Order', 'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling', 'Production Order', 'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling',
@ -56,6 +58,8 @@ domains = {
} }
def setup_domain(domain): def setup_domain(domain):
domains = get_domains()
if not domain in domains: if not domain in domains:
return return