fix: Filter Discount Account list

This commit is contained in:
GangaManoj 2021-07-12 19:07:54 +05:30 committed by Deepesh Garg
parent d24b5f707a
commit cfb94175a2

View File

@ -510,15 +510,6 @@ cur_frm.set_query("income_account", "items", function(doc) {
} }
}); });
// Discount Account in Details Table
// --------------------------------
cur_frm.set_query("discount_account", "items", function(doc) {
return{
query: "erpnext.controllers.queries.get_income_account",
filters: {'company': doc.company}
}
});
// Cost Center in Details Table // Cost Center in Details Table
// ----------------------------- // -----------------------------
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) { cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
@ -626,6 +617,19 @@ frappe.ui.form.on('Sales Invoice', {
} }
} }
// discount account
frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
if (erpnext.is_perpetual_inventory_enabled(doc.company)) {
return {
filters: {
'report_type': 'Profit and Loss',
'company': doc.company,
"is_group": 0
}
}
}
}
frm.fields_dict['items'].grid.get_field('deferred_revenue_account').get_query = function(doc) { frm.fields_dict['items'].grid.get_field('deferred_revenue_account').get_query = function(doc) {
return { return {
filters: { filters: {