Bootstrap documents for closing (js)

This commit is contained in:
Gaurav Naik 2018-05-14 18:06:50 +05:30
parent 2fe38c3ff5
commit 52571a80da

View File

@ -2,7 +2,23 @@
// For license information, please see license.txt
frappe.ui.form.on('Accounting Period', {
refresh: function(frm) {
onload: function(frm) {
if(frm.doc.closed_documents.length === 0 || (frm.doc.closed_documents.length === 1 && frm.doc.closed_documents[0].document_type == undefined)) {
frappe.call({
method: "get_doctypes_for_closing",
doc:frm.doc,
callback: function(r) {
if(r.message) {
cur_frm.clear_table("closed_documents");
r.message.forEach(function(element) {
var c = frm.add_child("closed_documents");
c.document_type = element.document_type;
c.closed = element.closed;
});
refresh_field("closed_documents");
}
}
});
}
}
});