Fixed get_query for default data in item

This commit is contained in:
Rohit Waghchaure 2018-05-18 16:39:08 +05:30
parent 6cdaa6e861
commit 73a99441ca

View File

@ -216,15 +216,19 @@ var set_customer_group = function(frm, cdt, cdn) {
$.extend(erpnext.item, {
setup_queries: function(frm) {
frm.fields_dict["item_defaults"].grid.get_field("expense_account").get_query = function(doc) {
frm.fields_dict["item_defaults"].grid.get_field("expense_account").get_query = function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
query: "erpnext.controllers.queries.get_expense_account",
filters: { company: row.company }
}
}
frm.fields_dict["item_defaults"].grid.get_field("income_account").get_query = function(doc) {
frm.fields_dict["item_defaults"].grid.get_field("income_account").get_query = function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
query: "erpnext.controllers.queries.get_income_account"
query: "erpnext.controllers.queries.get_income_account",
filters: { company: row.company }
}
}
@ -238,9 +242,13 @@ $.extend(erpnext.item, {
}
}
frm.fields_dict["item_defaults"].grid.get_field("selling_cost_center").get_query = function(doc) {
frm.fields_dict["item_defaults"].grid.get_field("selling_cost_center").get_query = function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: { "is_group": 0 }
filters: {
"is_group": 0,
"company": row.company
}
}
}
@ -271,9 +279,13 @@ $.extend(erpnext.item, {
return { query: "erpnext.controllers.queries.supplier_query" }
}
frm.fields_dict["item_defaults"].grid.get_field("default_warehouse").get_query = function(doc) {
frm.fields_dict["item_defaults"].grid.get_field("default_warehouse").get_query = function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: { "is_group": 0 }
filters: {
"is_group": 0,
"company": row.company
}
}
}