Merge branch 'fix-supplier-scorecard' of /home/snv/Work/master_bench/apps/erpnext into fix-scorecard
This commit is contained in:
commit
fb256d68ff
@ -13,15 +13,23 @@ frappe.ui.form.on("Supplier Scorecard", {
|
|||||||
},
|
},
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if (frm.doc.__unsaved == 1) {
|
if (frm.doc.__unsaved == 1) {
|
||||||
loadAllCriteria(frm);
|
|
||||||
loadAllStandings(frm);
|
loadAllStandings(frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
refresh: function(frm) {
|
load_criteria: function(frm) {
|
||||||
if (frm.dashboard.hasOwnProperty('heatmap')) {
|
frappe.call({
|
||||||
frm.dashboard.heatmap.setLegend([0,20,40,60,80,101],["#991600","#169900"]);
|
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_criteria_list",
|
||||||
}
|
callback: function(r) {
|
||||||
|
frm.set_value('criteria', []);
|
||||||
|
for (var i = 0; i < r.message.length; i++)
|
||||||
|
{
|
||||||
|
var row = frm.add_child("criteria");
|
||||||
|
row.criteria_name = r.message[i].name;
|
||||||
|
frm.script_manager.trigger("criteria_name", row.doctype, row.name);
|
||||||
|
}
|
||||||
|
refresh_field("criteria");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -29,8 +37,8 @@ frappe.ui.form.on("Supplier Scorecard", {
|
|||||||
frappe.ui.form.on("Supplier Scorecard Scoring Standing", {
|
frappe.ui.form.on("Supplier Scorecard Scoring Standing", {
|
||||||
|
|
||||||
standing_name: function(frm, cdt, cdn) {
|
standing_name: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.standing_name != undefined) {
|
var d = frappe.get_doc(cdt, cdn);
|
||||||
var d = frappe.get_doc(cdt, cdn);
|
if (d.standing_name) {
|
||||||
return frm.call({
|
return frm.call({
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_scoring_standing",
|
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_scoring_standing",
|
||||||
child: d,
|
child: d,
|
||||||
@ -42,86 +50,29 @@ frappe.ui.form.on("Supplier Scorecard Scoring Standing", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("Supplier Scorecard Scoring Variable", {
|
|
||||||
|
|
||||||
variable_label: function(frm, cdt, cdn) {
|
|
||||||
if (frm.doc.variable_label != undefined) {
|
|
||||||
var d = frappe.get_doc(cdt, cdn);
|
|
||||||
return frm.call({
|
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable.get_scoring_variable",
|
|
||||||
child: d,
|
|
||||||
args: {
|
|
||||||
variable_label: d.variable_label
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.ui.form.on("Supplier Scorecard Scoring Criteria", {
|
frappe.ui.form.on("Supplier Scorecard Scoring Criteria", {
|
||||||
|
|
||||||
criteria_name: function(frm, cdt, cdn) {
|
criteria_name: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.criteria_name != undefined) {
|
var d = frappe.get_doc(cdt, cdn);
|
||||||
var d = frappe.get_doc(cdt, cdn);
|
if (d.criteria_name) {
|
||||||
frm.call({
|
return frm.call({
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_variables",
|
method: "frappe.client.get",
|
||||||
args: {
|
args: {
|
||||||
criteria_name: d.criteria_name
|
fieldname: "weight",
|
||||||
|
doctype: "Supplier Scorecard Criteria",
|
||||||
|
filters: {name: d.criteria_name}
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
for (var i = 0; i < r.message.length; i++)
|
if(r.message){
|
||||||
{
|
d.weight = r.message.weight;
|
||||||
var exists = false;
|
frm.refresh_field('criteria', 'weight');
|
||||||
for (var j = 0; j < frm.doc.variables.length; j++)
|
|
||||||
{
|
|
||||||
if(!frm.doc.variables[j].hasOwnProperty("variable_label")) {
|
|
||||||
frm.get_field("variables").grid.grid_rows[j].remove();
|
|
||||||
}
|
|
||||||
else if(frm.doc.variables[j].variable_label === r.message[i]) {
|
|
||||||
exists = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!exists){
|
|
||||||
var new_row = frm.add_child("variables");
|
|
||||||
new_row.variable_label = r.message[i];
|
|
||||||
frm.script_manager.trigger("variable_label", new_row.doctype, new_row.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
refresh_field("variables");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return frm.call({
|
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_scoring_criteria",
|
|
||||||
child: d,
|
|
||||||
args: {
|
|
||||||
criteria_name: d.criteria_name
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var loadAllCriteria = function(frm) {
|
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_criteria_list",
|
|
||||||
callback: function(r) {
|
|
||||||
for (var j = 0; j < frm.doc.criteria.length; j++)
|
|
||||||
{
|
|
||||||
if(!frm.doc.criteria[j].hasOwnProperty("criteria_name")) {
|
|
||||||
frm.get_field("criteria").grid.grid_rows[j].remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0; i < r.message.length; i++)
|
|
||||||
{
|
|
||||||
var new_row = frm.add_child("criteria");
|
|
||||||
new_row.criteria_name = r.message[i].name;
|
|
||||||
frm.script_manager.trigger("criteria_name", new_row.doctype, new_row.name);
|
|
||||||
}
|
|
||||||
refresh_field("criteria");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var loadAllStandings = function(frm) {
|
var loadAllStandings = function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_standings_list",
|
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_standings_list",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:supplier",
|
"autoname": "field:supplier",
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:40:54.786555",
|
"creation": "2017-05-29 01:40:54.786555",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -182,7 +182,7 @@
|
|||||||
"label": "Evaluation Period",
|
"label": "Evaluation Period",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"options": "Per Month\nPer Week\nPer Year",
|
"options": "Per Week\nPer Month\nPer Year",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@ -318,6 +318,36 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "load_criteria",
|
||||||
|
"fieldtype": "Button",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Load All Criteria",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -349,37 +379,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "variables",
|
|
||||||
"fieldtype": "Table",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Supplier Variables",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Supplier Scorecard Scoring Variable",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -662,7 +661,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:11.874949",
|
"modified": "2019-01-22 11:42:19.918990",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard",
|
"name": "Supplier Scorecard",
|
||||||
|
@ -54,6 +54,7 @@ class SupplierScorecard(Document):
|
|||||||
`tabSupplier Scorecard Period` scp
|
`tabSupplier Scorecard Period` scp
|
||||||
WHERE
|
WHERE
|
||||||
scp.scorecard = %(sc)s
|
scp.scorecard = %(sc)s
|
||||||
|
AND scp.docstatus = 1
|
||||||
ORDER BY
|
ORDER BY
|
||||||
scp.end_date DESC""",
|
scp.end_date DESC""",
|
||||||
{"sc": self.name}, as_dict=1)
|
{"sc": self.name}, as_dict=1)
|
||||||
@ -110,7 +111,8 @@ def get_timeline_data(doctype, name):
|
|||||||
FROM
|
FROM
|
||||||
`tabSupplier Scorecard Period` sc
|
`tabSupplier Scorecard Period` sc
|
||||||
WHERE
|
WHERE
|
||||||
sc.scorecard = %(scs)s""",
|
sc.scorecard = %(scs)s
|
||||||
|
AND sc.docstatus = 1""",
|
||||||
{"scs": scs.name}, as_dict=1)
|
{"scs": scs.name}, as_dict=1)
|
||||||
|
|
||||||
for sc in scorecards:
|
for sc in scorecards:
|
||||||
@ -162,6 +164,7 @@ def make_all_scorecards(docname):
|
|||||||
`tabSupplier Scorecard Period` scp
|
`tabSupplier Scorecard Period` scp
|
||||||
WHERE
|
WHERE
|
||||||
scp.scorecard = %(sc)s
|
scp.scorecard = %(sc)s
|
||||||
|
AND scp.docstatus = 1
|
||||||
AND (
|
AND (
|
||||||
(scp.start_date > %(end_date)s
|
(scp.start_date > %(end_date)s
|
||||||
AND scp.end_date < %(start_date)s)
|
AND scp.end_date < %(start_date)s)
|
||||||
@ -170,12 +173,12 @@ def make_all_scorecards(docname):
|
|||||||
AND scp.end_date > %(start_date)s))
|
AND scp.end_date > %(start_date)s))
|
||||||
ORDER BY
|
ORDER BY
|
||||||
scp.end_date DESC""",
|
scp.end_date DESC""",
|
||||||
{"sc": docname, "start_date": start_date, "end_date": end_date, "supplier": supplier}, as_dict=1)
|
{"sc": docname, "start_date": start_date, "end_date": end_date}, as_dict=1)
|
||||||
if len(scorecards) == 0:
|
if len(scorecards) == 0:
|
||||||
period_card = make_supplier_scorecard(docname, None)
|
period_card = make_supplier_scorecard(docname, None)
|
||||||
period_card.start_date = start_date
|
period_card.start_date = start_date
|
||||||
period_card.end_date = end_date
|
period_card.end_date = end_date
|
||||||
period_card.save()
|
period_card.submit()
|
||||||
scp_count = scp_count + 1
|
scp_count = scp_count + 1
|
||||||
if start_date < first_start_date:
|
if start_date < first_start_date:
|
||||||
first_start_date = start_date
|
first_start_date = start_date
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:criteria_name",
|
"autoname": "field:criteria_name",
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:32:43.064891",
|
"creation": "2017-05-29 01:32:43.064891",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -43,36 +43,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 1
|
"unique": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "weight",
|
|
||||||
"fieldtype": "Percent",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Criteria Weight",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -87,7 +57,7 @@
|
|||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Max Score",
|
"label": "Max Score",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
@ -114,10 +84,10 @@
|
|||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 1,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Criteria Formula",
|
"label": "Criteria Formula",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
@ -133,6 +103,36 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "weight",
|
||||||
|
"fieldtype": "Percent",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Criteria Weight",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
@ -145,7 +145,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-17 10:30:47.458285",
|
"modified": "2019-01-22 10:47:00.000822",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Criteria",
|
"name": "Supplier Scorecard Criteria",
|
||||||
|
@ -36,15 +36,6 @@ class SupplierScorecardCriteria(Document):
|
|||||||
except Exception:
|
except Exception:
|
||||||
frappe.throw(_("Error evaluating the criteria formula"))
|
frappe.throw(_("Error evaluating the criteria formula"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def get_scoring_criteria(criteria_name):
|
|
||||||
criteria = frappe.get_doc("Supplier Scorecard Criteria", criteria_name)
|
|
||||||
|
|
||||||
return criteria
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_criteria_list():
|
def get_criteria_list():
|
||||||
criteria = frappe.db.sql("""
|
criteria = frappe.db.sql("""
|
||||||
@ -56,7 +47,6 @@ def get_criteria_list():
|
|||||||
|
|
||||||
return criteria
|
return criteria
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def get_variables(criteria_name):
|
def get_variables(criteria_name):
|
||||||
criteria = frappe.get_doc("Supplier Scorecard Criteria", criteria_name)
|
criteria = frappe.get_doc("Supplier Scorecard Criteria", criteria_name)
|
||||||
return _get_variables(criteria)
|
return _get_variables(criteria)
|
||||||
@ -69,21 +59,16 @@ def _get_variables(criteria):
|
|||||||
for dummy1, match in enumerate(mylist):
|
for dummy1, match in enumerate(mylist):
|
||||||
for dummy2 in range(0, len(match.groups())):
|
for dummy2 in range(0, len(match.groups())):
|
||||||
try:
|
try:
|
||||||
#var = frappe.get_doc("Supplier Scorecard Variable", {'param_name' : d})
|
|
||||||
var = frappe.db.sql("""
|
var = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
scv.name
|
scv.variable_label, scv.description, scv.param_name, scv.path
|
||||||
FROM
|
FROM
|
||||||
`tabSupplier Scorecard Variable` scv
|
`tabSupplier Scorecard Variable` scv
|
||||||
WHERE
|
WHERE
|
||||||
param_name=%(param)s""",
|
param_name=%(param)s""",
|
||||||
{'param':match.group(1)},)[0][0]
|
{'param':match.group(1)}, as_dict=1)[0]
|
||||||
my_variables.append(var)
|
my_variables.append(var)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Ignore the ones where the variable can't be found
|
|
||||||
frappe.throw(_('Unable to find variable: ') + str(match.group(1)), InvalidFormulaVariable)
|
frappe.throw(_('Unable to find variable: ') + str(match.group(1)), InvalidFormulaVariable)
|
||||||
#pass
|
|
||||||
|
|
||||||
|
|
||||||
#frappe.msgprint(str(my_variables))
|
|
||||||
return my_variables
|
return my_variables
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
|
|
||||||
frappe.ui.form.on("Supplier Scorecard Period", {
|
frappe.ui.form.on("Supplier Scorecard Period", {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.get_field("variables").grid.toggle_display("value", true);
|
let criteria_grid = frm.get_field("criteria").grid;
|
||||||
frm.get_field("criteria").grid.toggle_display("score", true);
|
criteria_grid.toggle_enable("criteria_name", false);
|
||||||
|
criteria_grid.toggle_enable("weight", false);
|
||||||
|
criteria_grid.toggle_display("max_score", true);
|
||||||
|
criteria_grid.toggle_display("formula", true);
|
||||||
|
criteria_grid.toggle_display("score", true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "naming_series:",
|
"autoname": "naming_series:",
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-30 00:38:18.773013",
|
"creation": "2017-05-30 00:38:18.773013",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -281,7 +281,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -346,6 +346,36 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "amended_from",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Amended From",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 1,
|
||||||
|
"options": "Supplier Scorecard Period",
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 1,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
@ -354,11 +384,11 @@
|
|||||||
"idx": 0,
|
"idx": 0,
|
||||||
"image_view": 0,
|
"image_view": 0,
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"is_submittable": 0,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:26.130861",
|
"modified": "2019-01-23 13:58:26.137770",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Period",
|
"name": "Supplier Scorecard Period",
|
||||||
@ -368,7 +398,7 @@
|
|||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
"apply_user_permissions": 0,
|
"apply_user_permissions": 0,
|
||||||
"cancel": 0,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
@ -382,7 +412,7 @@
|
|||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -8,6 +8,7 @@ from frappe import throw, _
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
import erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable as variable_functions
|
import erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable as variable_functions
|
||||||
|
from erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria import get_variables
|
||||||
|
|
||||||
class SupplierScorecardPeriod(Document):
|
class SupplierScorecardPeriod(Document):
|
||||||
|
|
||||||
@ -28,7 +29,6 @@ class SupplierScorecardPeriod(Document):
|
|||||||
|
|
||||||
def calculate_variables(self):
|
def calculate_variables(self):
|
||||||
for var in self.variables:
|
for var in self.variables:
|
||||||
|
|
||||||
if '.' in var.path:
|
if '.' in var.path:
|
||||||
method_to_call = import_string_path(var.path)
|
method_to_call = import_string_path(var.path)
|
||||||
var.value = method_to_call(self)
|
var.value = method_to_call(self)
|
||||||
@ -39,14 +39,8 @@ class SupplierScorecardPeriod(Document):
|
|||||||
|
|
||||||
|
|
||||||
def calculate_criteria(self):
|
def calculate_criteria(self):
|
||||||
#Get the criteria
|
|
||||||
for crit in self.criteria:
|
for crit in self.criteria:
|
||||||
|
|
||||||
#me = ""
|
|
||||||
my_eval_statement = crit.formula.replace("\r", "").replace("\n", "")
|
my_eval_statement = crit.formula.replace("\r", "").replace("\n", "")
|
||||||
#for let in my_eval_statement:
|
|
||||||
# me += let.encode('hex') + " "
|
|
||||||
#frappe.msgprint(me)
|
|
||||||
|
|
||||||
for var in self.variables:
|
for var in self.variables:
|
||||||
if var.value:
|
if var.value:
|
||||||
@ -102,30 +96,28 @@ def import_string_path(path):
|
|||||||
return mod
|
return mod
|
||||||
|
|
||||||
|
|
||||||
def post_process(source, target):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_supplier_scorecard(source_name, target_doc=None):
|
def make_supplier_scorecard(source_name, target_doc=None):
|
||||||
#def update_item(obj, target, source_parent):
|
def update_criteria_fields(obj, target, source_parent):
|
||||||
# target.qty = flt(obj.qty) - flt(obj.received_qty)
|
target.max_score, target.formula = frappe.db.get_value('Supplier Scorecard Criteria',
|
||||||
# target.stock_qty = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)
|
obj.criteria_name, ['max_score', 'formula'])
|
||||||
# target.amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.rate)
|
|
||||||
# target.base_amount = (flt(obj.qty) - flt(obj.received_qty)) * \
|
def post_process(source, target):
|
||||||
# flt(obj.rate) * flt(source_parent.conversion_rate)
|
variables = []
|
||||||
|
for cr in target.criteria:
|
||||||
|
for var in get_variables(cr.criteria_name):
|
||||||
|
if var not in variables:
|
||||||
|
variables.append(var)
|
||||||
|
|
||||||
|
target.extend('variables', variables)
|
||||||
|
|
||||||
doc = get_mapped_doc("Supplier Scorecard", source_name, {
|
doc = get_mapped_doc("Supplier Scorecard", source_name, {
|
||||||
"Supplier Scorecard": {
|
"Supplier Scorecard": {
|
||||||
"doctype": "Supplier Scorecard Period"
|
"doctype": "Supplier Scorecard Period"
|
||||||
},
|
},
|
||||||
"Supplier Scorecard Scoring Variable": {
|
"Supplier Scorecard Scoring Criteria": {
|
||||||
"doctype": "Supplier Scorecard Scoring Variable",
|
"doctype": "Supplier Scorecard Scoring Criteria",
|
||||||
"add_if_empty": True
|
"postprocess": update_criteria_fields,
|
||||||
},
|
|
||||||
"Supplier Scorecard Scoring Constraint": {
|
|
||||||
"doctype": "Supplier Scorecard Scoring Constraint",
|
|
||||||
"add_if_empty": True
|
|
||||||
}
|
}
|
||||||
}, target_doc, post_process)
|
}, target_doc, post_process)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:32:17.988454",
|
"creation": "2017-05-29 01:32:17.988454",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 3,
|
"columns": 5,
|
||||||
"fieldname": "criteria_name",
|
"fieldname": "criteria_name",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -43,14 +43,44 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 2,
|
||||||
|
"fieldname": "score",
|
||||||
|
"fieldtype": "Percent",
|
||||||
|
"hidden": 1,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 1,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Score",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "section_break_2",
|
"fieldname": "column_break_4",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
@ -90,6 +120,7 @@
|
|||||||
"label": "Criteria Weight",
|
"label": "Criteria Weight",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
|
"options": "",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@ -102,35 +133,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_4",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -140,7 +142,7 @@
|
|||||||
"default": "100",
|
"default": "100",
|
||||||
"fieldname": "max_score",
|
"fieldname": "max_score",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
@ -154,7 +156,7 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -199,7 +201,7 @@
|
|||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "formula",
|
"fieldname": "formula",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
@ -213,37 +215,7 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "score",
|
|
||||||
"fieldtype": "Percent",
|
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Score",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -262,7 +234,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:41.532361",
|
"modified": "2019-01-23 13:49:13.350095",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Scoring Criteria",
|
"name": "Supplier Scorecard Scoring Criteria",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:36:22.697234",
|
"creation": "2017-05-29 01:36:22.697234",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -473,7 +473,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:20.615684",
|
"modified": "2019-01-22 10:47:41.146704",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Scoring Standing",
|
"name": "Supplier Scorecard Scoring Standing",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:30:06.105240",
|
"creation": "2017-05-29 01:30:06.105240",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
@ -65,7 +65,37 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 2,
|
||||||
|
"fieldname": "value",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 1,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Value",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -73,36 +103,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "is_custom",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Custom?",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -111,7 +111,7 @@
|
|||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "param_name",
|
"fieldname": "param_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
@ -128,7 +128,7 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -141,7 +141,7 @@
|
|||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "path",
|
"fieldname": "path",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
@ -158,36 +158,6 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 2,
|
|
||||||
"fieldname": "value",
|
|
||||||
"fieldtype": "Float",
|
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Value",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
@ -204,7 +174,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:36.671502",
|
"modified": "2019-01-23 09:55:19.749828",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Scoring Variable",
|
"name": "Supplier Scorecard Scoring Variable",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:standing_name",
|
"autoname": "field:standing_name",
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:36:47.893639",
|
"creation": "2017-05-29 01:36:47.893639",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -385,7 +385,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:16.560273",
|
"modified": "2019-01-22 10:47:49.195421",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Standing",
|
"name": "Supplier Scorecard Standing",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:variable_label",
|
"autoname": "field:variable_label",
|
||||||
"beta": 1,
|
"beta": 0,
|
||||||
"creation": "2017-05-29 01:30:34.688389",
|
"creation": "2017-05-29 01:30:34.688389",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@ -101,7 +101,7 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
@ -203,7 +203,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-07-12 07:33:31.395262",
|
"modified": "2019-01-23 09:39:59.866398",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Scorecard Variable",
|
"name": "Supplier Scorecard Variable",
|
||||||
|
@ -27,13 +27,6 @@ class SupplierScorecardVariable(Document):
|
|||||||
if not hasattr(sys.modules[__name__], self.path):
|
if not hasattr(sys.modules[__name__], self.path):
|
||||||
frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound)
|
frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def get_scoring_variable(variable_label):
|
|
||||||
variable = frappe.get_doc("Supplier Scorecard Variable", variable_label)
|
|
||||||
|
|
||||||
return variable
|
|
||||||
|
|
||||||
def get_total_workdays(scorecard):
|
def get_total_workdays(scorecard):
|
||||||
""" Gets the number of days in this period"""
|
""" Gets the number of days in this period"""
|
||||||
delta = getdate(scorecard.end_date) - getdate(scorecard.start_date)
|
delta = getdate(scorecard.end_date) - getdate(scorecard.start_date)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user