[fix] Get defaults based on doctype or fieldname
This commit is contained in:
parent
d55d0c06e3
commit
b6b56453e1
@ -66,7 +66,7 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
|
||||
$.each(r.message, function(i, v) {
|
||||
$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
|
||||
});
|
||||
wrapper.$company_select.val(frappe.defaults.get_user_default("company") || r.message[0]).change();
|
||||
wrapper.$company_select.val(frappe.defaults.get_user_default("Company") || r.message[0]).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier",
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier",
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
|
@ -22,7 +22,7 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
label: __("Company"),
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: frappe.defaults.get_user_default("company")
|
||||
default: frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
]
|
||||
}
|
@ -8,7 +8,7 @@ frappe.query_reports["General Ledger"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ frappe.query_reports["Gross Profit"] = {
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
|
@ -33,7 +33,7 @@ frappe.query_reports["Item-wise Purchase Register"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
reqd: 1,
|
||||
default: frappe.defaults.get_user_default("company")
|
||||
default: frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
fieldname: "from_date",
|
||||
|
@ -27,7 +27,7 @@ frappe.query_reports["Purchase Register"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ frappe.query_reports["Sales Register"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ frappe.query_reports["Trial Balance"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Trial Balance for Party"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ def get_actual_expense(args):
|
||||
def get_currency_precision(currency=None):
|
||||
if not currency:
|
||||
currency = frappe.db.get_value("Company",
|
||||
frappe.db.get_default("company"), "default_currency", cache=True)
|
||||
frappe.db.get_default("Company"), "default_currency", cache=True)
|
||||
currency_format = frappe.db.get_value("Currency", currency, "number_format", cache=True)
|
||||
|
||||
from frappe.utils import get_number_format_info
|
||||
|
@ -90,7 +90,7 @@ def _make_customer(source_name, target_doc=None, ignore_permissions=False):
|
||||
target.customer_type = "Individual"
|
||||
target.customer_name = source.lead_name
|
||||
|
||||
target.customer_group = frappe.db.get_default("customer_group")
|
||||
target.customer_group = frappe.db.get_default("Customer Group")
|
||||
|
||||
doclist = get_mapped_doc("Lead", source_name,
|
||||
{"Lead": {
|
||||
|
@ -121,7 +121,7 @@ def create_lead(email_id):
|
||||
"lead_name": real_name or email_id,
|
||||
"status": "Lead",
|
||||
"naming_series": get_default_naming_series("Lead"),
|
||||
"company": frappe.db.get_default("company"),
|
||||
"company": frappe.db.get_default("Company"),
|
||||
"source": "Email"
|
||||
})
|
||||
lead.insert()
|
||||
|
@ -29,8 +29,8 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
||||
|
||||
if(!this.frm.doc.status)
|
||||
set_multiple(cdt, cdn, { status:'Draft' });
|
||||
if(!this.frm.doc.company && frappe.defaults.get_user_default("company"))
|
||||
set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("company") });
|
||||
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
|
||||
set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("Company") });
|
||||
if(!this.frm.doc.fiscal_year && sys_defaults.fiscal_year)
|
||||
set_multiple(cdt, cdn, { fiscal_year:sys_defaults.fiscal_year });
|
||||
|
||||
|
@ -13,7 +13,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc,cdt,cdn){
|
||||
if(doc.__islocal && doc.employee==frappe.defaults.get_user_default("employee")) {
|
||||
if(doc.__islocal && doc.employee==frappe.defaults.get_user_default("Employee")) {
|
||||
cur_frm.set_value("employee", "");
|
||||
cur_frm.set_value("employee_name", "")
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ frappe.query_reports["Employee Birthday"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
@ -23,7 +23,7 @@ frappe.query_reports["Employee Leave Balance"] = {
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
@ -29,7 +29,7 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
@ -29,7 +29,7 @@ frappe.query_reports["Monthly Salary Register"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
frappe.ui.form.on("Hub Settings", "onload", function(frm) {
|
||||
if(!frm.doc.seller_country) {
|
||||
frm.set_value("seller_country", frappe.defaults.get_default("country"));
|
||||
frm.set_value("seller_country", frappe.defaults.get_default("Country"));
|
||||
}
|
||||
if(!frm.doc.seller_name) {
|
||||
frm.set_value("seller_name", frappe.defaults.get_default("company"));
|
||||
frm.set_value("seller_name", frappe.defaults.get_default("Company"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.set_value("company", frappe.defaults.get_user_default("company"))
|
||||
cur_frm.set_value("company", frappe.defaults.get_user_default("Company"))
|
||||
cur_frm.set_value("use_multi_level_bom", 1)
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class Workstation(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_default_holiday_list():
|
||||
return frappe.db.get_value("Company", frappe.defaults.get_user_default("company"), "default_holiday_list")
|
||||
return frappe.db.get_value("Company", frappe.defaults.get_user_default("Company"), "default_holiday_list")
|
||||
|
||||
def check_if_within_operating_hours(workstation, operation, from_datetime, to_datetime):
|
||||
if from_datetime and to_datetime:
|
||||
|
@ -7,7 +7,7 @@ erpnext.financial_statements = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ var get_filters = function(){
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
];
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ var get_filters = function(){
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
];
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Customer Acquisition and Loyalty"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ frappe.query_reports["Customer Credit Balance"] = {
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
|
@ -33,7 +33,7 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = {
|
||||
label: __("Company"),
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: frappe.defaults.get_user_default("company")
|
||||
default: frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
fieldname:"item_group",
|
||||
|
@ -143,7 +143,7 @@ def get_basic_details(args, item):
|
||||
item.update_template_tables()
|
||||
|
||||
from frappe.defaults import get_user_default_as_list
|
||||
user_default_warehouse_list = get_user_default_as_list('warehouse')
|
||||
user_default_warehouse_list = get_user_default_as_list('Warehouse')
|
||||
user_default_warehouse = user_default_warehouse_list[0] \
|
||||
if len(user_default_warehouse_list)==1 else ""
|
||||
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Stock Ageing"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Stock Ledger"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class Issue(Document):
|
||||
|
||||
if not self.company:
|
||||
self.company = frappe.db.get_value("Lead", self.lead, "company") or \
|
||||
frappe.db.get_default("company")
|
||||
frappe.db.get_default("Company")
|
||||
|
||||
def update_status(self):
|
||||
status = frappe.db.get_value("Issue", self.name, "status")
|
||||
|
Loading…
x
Reference in New Issue
Block a user