cleanup global defaults, fix #2838:

This commit is contained in:
Rushabh Mehta 2015-03-02 13:01:39 +05:30
parent 16018dd474
commit 905f8328ab
10 changed files with 87 additions and 128 deletions

View File

@ -128,3 +128,4 @@ erpnext.patches.v5_0.taxes_and_totals_in_party_currency
erpnext.patches.v5_0.replace_renamed_fields_in_custom_scripts_and_print_formats
erpnext.patches.v5_0.update_from_bom
erpnext.patches.v5_0.update_account_types
erpnext.patches.v5_0.update_sms_sender

View File

@ -1,7 +1,7 @@
# 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
def execute():

View File

@ -0,0 +1,9 @@
# 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
def execute():
frappe.db.set_value("SMS Settings", "SMS Settings", "sms_sender_name",
frappe.db.get_single_value("Global Defaults", "sms_sender_name"))

View File

@ -0,0 +1,12 @@
# 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
def execute():
frappe.reload_doctype("Time Log")
for d in frappe.get_all("Time Log"):
time_log = frappe.get_doc("Time Log", d.name)
time_log.set_title()
frappe.db.set_value("Time Log", time_log.name, "title", time_log.title)

View File

@ -2,46 +2,9 @@
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
onload: function(doc) {
var me = this;
this.timezone = doc.time_zone;
frappe.call({
method: "frappe.geo.country_info.get_country_timezone_info",
callback: function(data) {
frappe.country_info = data.message.country_info;
frappe.all_timezones = data.message.all_timezones;
me.set_timezone_options();
cur_frm.set_value("time_zone", me.timezone);
}
});
},
validate: function(doc, cdt, cdn) {
return $c_obj(doc, 'get_defaults', '', function(r, rt){
sys_defaults = r.message;
});
},
country: function() {
var me = this;
var timezones = [];
if (this.frm.doc.country) {
var timezones = (frappe.country_info[this.frm.doc.country].timezones || []).sort();
}
this.frm.set_value("time_zone", timezones[0]);
this.set_timezone_options(timezones);
},
set_timezone_options: function(filtered_options) {
var me = this;
if(!filtered_options) filtered_options = [];
var remaining_timezones = $.map(frappe.all_timezones, function(v)
{ return filtered_options.indexOf(v)===-1 ? v : null; });
this.frm.set_df_property("time_zone", "options",
(filtered_options.concat([""]).concat(remaining_timezones)).join("\n"));
}
});

View File

@ -5,20 +5,36 @@
"doctype": "DocType",
"fields": [
{
"fieldname": "currency_settings",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "",
"fieldname": "default_company",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Default Company",
"options": "Company",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "current_fiscal_year",
"fieldtype": "Link",
"label": "Current Fiscal Year",
"options": "Fiscal Year",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "country",
"fieldtype": "Link",
"label": "Country",
"options": "Country",
"permlevel": 0
},
{
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Disable Rounded Total",
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
"precision": ""
},
{
"default": "INR",
@ -43,59 +59,11 @@
"read_only": 0
},
{
"fieldname": "company",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Company Settings",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "default_company",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Default Company",
"options": "Company",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "current_fiscal_year",
"fieldtype": "Link",
"label": "Current Fiscal Year",
"options": "Fiscal Year",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "system",
"fieldtype": "Section Break",
"label": "System Settings",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "country",
"fieldtype": "Link",
"label": "Country",
"options": "Country",
"permlevel": 0
},
{
"fieldname": "sms_sender_name",
"fieldtype": "Data",
"label": "SMS Sender Name",
"permlevel": 0,
"read_only": 0
},
{
"description": "For Server Side Print Formats",
"fieldname": "print_style",
"fieldtype": "Select",
"label": "Print Format Style",
"options": "Standard\nClassic\nModern\nSpartan",
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Disable Rounded Total",
"permlevel": 0,
"read_only": 0
}
@ -105,7 +73,7 @@
"idx": 1,
"in_create": 1,
"issingle": 1,
"modified": "2015-02-20 05:16:23.324563",
"modified": "2015-03-02 02:23:20.688406",
"modified_by": "Administrator",
"module": "Setup",
"name": "Global Defaults",

View File

@ -10,7 +10,6 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
keydict = {
# "key in defaults": "key in Global Defaults"
"print_style": "print_style",
"fiscal_year": "current_fiscal_year",
'company': 'default_company',
'currency': 'default_currency',

View File

@ -39,6 +39,13 @@
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "sms_sender_name",
"fieldtype": "Data",
"label": "SMS Sender Name",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "static_parameters_section",
"fieldtype": "Column Break",
@ -58,7 +65,7 @@
"idx": 1,
"in_create": 0,
"issingle": 1,
"modified": "2015-02-05 05:11:46.834990",
"modified": "2015-03-02 02:24:19.692599",
"modified_by": "Administrator",
"module": "Setup",
"name": "SMS Settings",

View File

@ -29,7 +29,7 @@ def validate_receiver_nos(receiver_list):
def get_sender_name():
"returns name as SMS sender"
sender_name = frappe.db.get_value('Global Defaults', None, 'sms_sender_name') or \
sender_name = frappe.db.get_single_value('SMS Settings', 'sms_sender_name') or \
'ERPNXT'
if len(sender_name) > 6 and \
frappe.db.get_default("country") == "India":

View File

@ -7,29 +7,29 @@ import frappe
def get_notification_config():
return { "for_doctype":
{
"Issue": {"status":"Open"},
"Warranty Claim": {"status":"Open"},
"Task": {"status":"Open"},
"Lead": {"status":"Open"},
"Contact": {"status":"Open"},
"Opportunity": {"docstatus":0},
"Quotation": {"docstatus":0},
"Sales Order": { "per_delivered": ("<", 100) },
"Journal Entry": {"docstatus":0},
"Sales Invoice": { "outstanding_amount": (">", 0) },
"Purchase Invoice": {"docstatus":0},
"Leave Application": {"status":"Open"},
"Expense Claim": {"approval_status":"Draft"},
"Job Applicant": {"status":"Open"},
"Purchase Receipt": {"docstatus":0},
"Delivery Note": {"docstatus":0},
"Stock Entry": {"docstatus":0},
"Material Request": {"docstatus":0},
"Purchase Order": { "per_received": ("<", 100) },
"Issue": {"status": "Open"},
"Warranty Claim": {"status": "Open"},
"Task": {"status": "Open"},
"Lead": {"status": "Open"},
"Contact": {"status": "Open"},
"Opportunity": {"docstatus": 0},
"Quotation": {"docstatus": 0},
"Sales Order": { "per_delivered": ("<", 100), "status": ("!=", "Stopped"), "docstatus": ("<", 2) },
"Journal Entry": {"docstatus": 0},
"Sales Invoice": { "outstanding_amount": (">", 0), "docstatus": ("<", 2) },
"Purchase Invoice": {"docstatus": 0},
"Leave Application": {"status": "Open"},
"Expense Claim": {"approval_status": "Draft"},
"Job Applicant": {"status": "Open"},
"Purchase Receipt": {"docstatus": 0},
"Delivery Note": {"docstatus": 0},
"Stock Entry": {"docstatus": 0},
"Material Request": {"docstatus": 0},
"Purchase Order": { "per_received": ("<", 100), "status": ("!=", "Stopped"), "docstatus": ("<", 2) },
"Production Order": { "status": "In Process" },
"BOM": {"docstatus":0},
"Timesheet": {"docstatus":0},
"Time Log": {"status":"Draft"},
"Time Log Batch": {"status":"Draft"},
"BOM": {"docstatus": 0},
"Timesheet": {"docstatus": 0},
"Time Log": {"status": "Draft"},
"Time Log Batch": {"status": "Draft"},
}
}