fix: Filtering issues in opneing invoice creation tool (#21969)

This commit is contained in:
Deepesh Garg 2020-05-27 20:27:33 +05:30 committed by GitHub
parent 873542bc7f
commit 0030b95595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,21 +11,9 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
}; };
}); });
frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) { if (frm.doc.company) {
return { frm.trigger('setup_company_filters');
filters: {
'company': doc.company
} }
};
});
frm.set_query('cost_center', function(doc) {
return {
filters: {
'company': doc.company
}
};
});
}, },
refresh: function(frm) { refresh: function(frm) {
@ -51,7 +39,37 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
}); });
}, },
setup_company_filters: function(frm) {
frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) {
return {
filters: {
'company': doc.company
}
};
});
frm.set_query('cost_center', function(doc) {
return {
filters: {
'company': doc.company
}
};
});
frm.set_query('temporary_opening_account', 'invoices', function(doc, cdt, cdn) {
return {
filters: {
'company': doc.company
}
}
});
},
company: function(frm) { company: function(frm) {
if (frm.doc.company) {
frm.trigger('setup_company_filters');
frappe.call({ frappe.call({
method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account', method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account',
args: { args: {
@ -64,6 +82,7 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
} }
} }
}) })
}
}, },
invoice_type: function(frm) { invoice_type: function(frm) {