<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

from __future__ import unicode_literals
import frappe

domains = {
	'Manufacturing': {
		'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
			'Production Order', 'Stock Entry', 'Buying', 'Selling', 'Accounts']
	},
	'Retail': {
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
		'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Accounts']
	},
	'Distribution': {
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
	},
	'Services': {
		'desktop_icons': ['Project', 'Time Log', 'Customer', 'Sales Invoice', 'Lead', 'Opportunity',
			'Expense Claim', 'Employee'],
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
		'properties': [
			{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
		],
		'set_value': [
			['Stock Settings', 'show_barcode', 0]
		]
	}
}

def setup_domain(domain):
	if not domain in domains:
		return

	from frappe.desk.doctype.desktop_icon.desktop_icon import set_desktop_icons
	data = frappe._dict(domains[domain])

	if data.remove_roles:
		for role in data.remove_roles:
			frappe.db.sql('delete from tabUserRole where role=%s', role)

	if data.desktop_icons:
		set_desktop_icons(data.desktop_icons)

	if data.properties:
		for args in data.properties:
			frappe.make_property_setter(args)

	frappe.clear_cache()

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`')<commit_msg>[minor] added set_value in domainify<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

from __future__ import unicode_literals
import frappe

domains = {
	'Manufacturing': {
		'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
			'Production Order', 'Stock Entry', 'Buying', 'Selling', 'Accounts']
	},
	'Retail': {
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
		'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Accounts']
	},
	'Distribution': {
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
	},
	'Services': {
		'desktop_icons': ['Project', 'Time Log', 'Customer', 'Sales Invoice', 'Lead', 'Opportunity',
			'Expense Claim', 'Employee'],
		'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
		'properties': [
			{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
		],
		'set_value': [
			['Stock Settings', None, 'show_barcode', 0]
		]
	}
}

def setup_domain(domain):
	if not domain in domains:
		return

	from frappe.desk.doctype.desktop_icon.desktop_icon import set_desktop_icons
	data = frappe._dict(domains[domain])

	if data.remove_roles:
		for role in data.remove_roles:
			frappe.db.sql('delete from tabUserRole where role=%s', role)

	if data.desktop_icons:
		set_desktop_icons(data.desktop_icons)

	if data.properties:
		for args in data.properties:
			frappe.make_property_setter(args)

	if data.set_value:
		for args in data.set_value:
			doc = frappe.get_doc(args[0], args[1] or args[0])
			doc.set(args[2], args[3])
			doc.save()

	frappe.clear_cache()

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`')
{'fraction_non_alphanumeric': 0.1562325321408608, 'fraction_numerical': 0.0047512576858580215, 'mean_word_length': 5.56697247706422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5436474', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1241, 'n_words': 296}