Merge branch 'emakis-in_words_configurable' into develop

This commit is contained in:
Anand Doshi 2016-03-07 20:00:54 +05:30
commit ba7b05ad27
2 changed files with 78 additions and 2 deletions

View File

@ -1,7 +1,10 @@
{
"allow_copy": 1,
"allow_email": 0,
"allow_import": 0,
"allow_print": 0,
"allow_rename": 0,
"allow_trash": 0,
"creation": "2013-05-02 17:53:24",
"custom": 0,
"docstatus": 0,
@ -15,13 +18,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Company",
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -37,13 +44,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Current Fiscal Year",
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -59,13 +70,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Country",
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -81,12 +96,16 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_column": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -103,13 +122,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Default Currency",
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -126,13 +149,17 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Hide Currency Symbol",
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "\nNo\nYes",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -149,12 +176,42 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Disable Rounded Total",
"length": 0,
"no_column": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If disable, 'In Words' field will not be visible in any transaction",
"fieldname": "disable_in_words",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Disable In Words",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -170,9 +227,12 @@
"in_create": 1,
"in_dialog": 0,
"is_submittable": 0,
"is_transaction_doc": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-06-30 03:00:26.420003",
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-03 16:14:41.260467",
"modified_by": "Administrator",
"module": "Setup",
"name": "Global Defaults",
@ -192,6 +252,7 @@
"print": 0,
"read": 1,
"report": 0,
"restrict": 0,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
@ -200,5 +261,9 @@
}
],
"read_only": 1,
"read_only_onload": 0
"read_only_onload": 0,
"show_in_menu": 0,
"sort_order": "DESC",
"use_template": 0,
"version": 0
}

View File

@ -17,6 +17,7 @@ keydict = {
'hide_currency_symbol':'hide_currency_symbol',
'account_url':'account_url',
'disable_rounded_total': 'disable_rounded_total',
'disable_in_words': 'disable_in_words',
}
from frappe.model.document import Document
@ -44,6 +45,7 @@ class GlobalDefaults(Document):
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
self.toggle_rounded_total()
self.toggle_in_words()
# clear cache
frappe.clear_cache()
@ -61,3 +63,12 @@ class GlobalDefaults(Document):
make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check")
make_property_setter(doctype, "rounded_total", "print_hide", self.disable_rounded_total, "Check")
def toggle_in_words(self):
self.disable_in_words = cint(self.disable_in_words)
# Make property setters to hide in words fields
for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
"Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"):
make_property_setter(doctype, "in_words", "hidden", self.disable_in_words, "Check")
make_property_setter(doctype, "in_words", "print_hide", self.disable_in_words, "Check")