fix(minor): fix dynamically changing grid properties

This commit is contained in:
Rushabh Mehta
2021-04-13 11:58:16 +05:30
parent 34d00772e7
commit 65f25c27b3
17 changed files with 69 additions and 162 deletions

View File

@@ -39,11 +39,13 @@ frappe.ui.form.on('Patient Assessment', {
},
set_score_range: function(frm) {
let options = [];
let options = [''];
for(let i = frm.doc.scale_min; i <= frm.doc.scale_max; i++) {
options.push(i);
}
frappe.meta.get_docfield('Patient Assessment Sheet', 'score', frm.doc.name).options = [''].concat(options);
frm.fields_dict.assessment_sheet.grid.update_docfield_property(
'score', 'options', options
);
},
calculate_total_score: function(frm, cdt, cdn) {
@@ -83,4 +85,4 @@ frappe.ui.form.on('Patient Assessment Sheet', {
score: function(frm, cdt, cdn) {
frm.events.calculate_total_score(frm, cdt, cdn);
}
});
});

View File

@@ -58,8 +58,12 @@ frappe.ui.form.on('Therapy Plan', {
}
if (frm.doc.therapy_plan_template) {
frappe.meta.get_docfield('Therapy Plan Detail', 'therapy_type', frm.doc.name).read_only = 1;
frappe.meta.get_docfield('Therapy Plan Detail', 'no_of_sessions', frm.doc.name).read_only = 1;
frm.fields_dict.therapy_plan_details.grid.update_docfield_property(
'therapy_type', 'read_only', 1,
);
frm.fields_dict.therapy_plan_details.grid.update_docfield_property(
'no_of_sessions', 'read_only', 1
);
}
},
@@ -126,4 +130,4 @@ frappe.ui.form.on('Therapy Plan Detail', {
frm.set_value('total_sessions', total);
refresh_field('total_sessions');
}
});
});