Merge pull request #22571 from marination/quality-feedback

fix: Quality Feedback and Template (minor)
This commit is contained in:
rohitwaghchaure 2020-07-06 13:17:10 +05:30 committed by GitHub
commit 661bc46b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 19 deletions

View File

@ -5,7 +5,9 @@ frappe.ui.form.on('Quality Feedback', {
refresh: function(frm) { refresh: function(frm) {
frm.set_value("date", frappe.datetime.get_today()); frm.set_value("date", frappe.datetime.get_today());
}, },
template: function(frm) { template: function(frm) {
if (frm.doc.template) {
frappe.call({ frappe.call({
"method": "frappe.client.get", "method": "frappe.client.get",
args: { args: {
@ -13,13 +15,18 @@ frappe.ui.form.on('Quality Feedback', {
name: frm.doc.template name: frm.doc.template
}, },
callback: function(data) { callback: function(data) {
if (data && data.message) {
frm.fields_dict.parameters.grid.remove_all(); frm.fields_dict.parameters.grid.remove_all();
for (var i in data.message.parameters){
frm.add_child("parameters"); // fetch parameters from template and autofill
frm.fields_dict.parameters.get_value()[i].parameter = data.message.parameters[i].parameter; for (let template_parameter of data.message.parameters) {
let row = frm.add_child("parameters");
row.parameter = template_parameter.parameter;
} }
frm.refresh(); frm.refresh();
} }
}); }
});
}
} }
}); });

View File

@ -1,4 +1,5 @@
{ {
"actions": [],
"autoname": "format:FDBK-{#####}", "autoname": "format:FDBK-{#####}",
"creation": "2019-05-26 21:23:05.308379", "creation": "2019-05-26 21:23:05.308379",
"doctype": "DocType", "doctype": "DocType",
@ -53,12 +54,13 @@
{ {
"fieldname": "document_name", "fieldname": "document_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"label": "Name", "label": "Feedback By",
"options": "document_type", "options": "document_type",
"reqd": 1 "reqd": 1
} }
], ],
"modified": "2019-05-28 15:16:01.161662", "links": [],
"modified": "2020-07-03 15:50:58.589302",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Quality Management", "module": "Quality Management",
"name": "Quality Feedback", "name": "Quality Feedback",

View File

@ -1,4 +1,5 @@
{ {
"actions": [],
"autoname": "format:TMPL-{template}", "autoname": "format:TMPL-{template}",
"creation": "2019-05-26 21:17:24.283061", "creation": "2019-05-26 21:17:24.283061",
"doctype": "DocType", "doctype": "DocType",
@ -30,10 +31,12 @@
"fieldname": "parameters", "fieldname": "parameters",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Parameters", "label": "Parameters",
"options": "Quality Feedback Template Parameter" "options": "Quality Feedback Template Parameter",
"reqd": 1
} }
], ],
"modified": "2019-05-26 21:48:47.770610", "links": [],
"modified": "2020-07-03 16:06:03.749415",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Quality Management", "module": "Quality Management",
"name": "Quality Feedback Template", "name": "Quality Feedback Template",