fix: reload procedure doc on completion

This commit is contained in:
Rucha Mahabal 2020-04-29 11:16:34 +05:30
parent c544b91e14
commit b30c9a5735
2 changed files with 7 additions and 4 deletions

View File

@ -80,6 +80,7 @@ frappe.ui.form.on('Clinical Procedure', {
frappe.call({
method: 'complete_procedure',
doc: frm.doc,
freeze: true,
callback: function(r) {
if (r.message) {
frappe.show_alert({
@ -87,8 +88,8 @@ frappe.ui.form.on('Clinical Procedure', {
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
indicator: 'green'
});
frm.reload_doc();
}
frm.reload_doc();
}
});
}
@ -111,9 +112,10 @@ frappe.ui.form.on('Clinical Procedure', {
frappe.call({
doc: frm.doc,
method: 'make_material_receipt',
freeze: true,
callback: function(r) {
if (!r.exc) {
cur_frm.reload_doc();
frm.reload_doc();
let doclist = frappe.model.sync(r.message);
frappe.set_route('Form', doclist[0].doctype, doclist[0].name);
}
@ -122,7 +124,7 @@ frappe.ui.form.on('Clinical Procedure', {
}
);
} else {
cur_frm.reload_doc();
frm.reload_doc();
}
}
}

View File

@ -87,7 +87,8 @@ class ClinicalProcedure(Document):
else:
frappe.throw(_('Please set Customer in Patient {0}').format(frappe.bold(self.patient)), title=_('Customer Not Found'))
frappe.db.set_value('Clinical Procedure', self.name, 'status', 'Completed')
self.db_set('status', 'Completed')
if self.consume_stock and self.items:
return stock_entry