[fix] [minor] sales and purchase get_queries
This commit is contained in:
parent
9eb2868bf1
commit
d5d39ac5ec
@ -49,6 +49,14 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
});
|
||||
}
|
||||
|
||||
$.each([["supplier", "supplier"],
|
||||
["contact_person", "supplier_filter"],
|
||||
["supplier_address", "supplier_filter"]],
|
||||
function(i, opts) {
|
||||
if(me.frm.fields_dict[opts[0]])
|
||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||
});
|
||||
|
||||
if(this.frm.fields_dict.supplier) {
|
||||
this.frm.set_query("supplier", function() {
|
||||
return{ query:"controllers.queries.supplier_query" }});
|
||||
|
@ -58,6 +58,15 @@ $.extend(erpnext.queries, {
|
||||
return { filters: { customer: doc.customer } };
|
||||
},
|
||||
|
||||
supplier_filter: function(doc) {
|
||||
if(!doc.supplier) {
|
||||
wn.throw(wn._("Please specify a") + " " +
|
||||
wn._(wn.meta.get_label(doc.doctype, "supplier", doc.name)));
|
||||
}
|
||||
|
||||
return { filters: { supplier: doc.supplier } };
|
||||
},
|
||||
|
||||
not_a_group_filter: function() {
|
||||
return { filters: { is_group: "No" } };
|
||||
},
|
||||
|
@ -36,22 +36,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
|
||||
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
||||
|
||||
if(this.frm.fields_dict.shipping_address_name && this.frm.fields_dict.customer_address) {
|
||||
this.frm.fields_dict.shipping_address_name.get_query =
|
||||
this.frm.fields_dict['customer_address'].get_query;
|
||||
}
|
||||
|
||||
this.frm.set_query("customer_address", function() {
|
||||
return {
|
||||
filters: {'customer': me.frm.doc.customer }
|
||||
}
|
||||
});
|
||||
|
||||
this.frm.set_query("contact_person", function() {
|
||||
return {
|
||||
filters: {'customer': me.frm.doc.customer }
|
||||
}
|
||||
});
|
||||
$.each([["customer_address", "customer_filter"],
|
||||
["shipping_address_name", "customer_filter"],
|
||||
["contact_person", "customer_filter"],
|
||||
["customer", "customer"],
|
||||
["lead", "lead"]],
|
||||
function(i, opts) {
|
||||
if(me.frm.fields_dict[opts[0]])
|
||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||
});
|
||||
|
||||
if(this.frm.fields_dict.charge) {
|
||||
this.frm.set_query("charge", function() {
|
||||
@ -63,13 +56,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.customer_query" } }
|
||||
|
||||
this.frm.fields_dict.lead && this.frm.set_query("lead", function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.lead_query" } });
|
||||
|
||||
if(this.frm.fields_dict.price_list_name) {
|
||||
this.frm.set_query("price_list_name", function() {
|
||||
return { filters: { buying_or_selling: "Selling" } };
|
||||
@ -130,11 +117,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
|
||||
if(this.frm.fields_dict.sales_team && this.frm.fields_dict.sales_team.grid.get_field("sales_person")) {
|
||||
this.frm.set_query("sales_person", "sales_team", function() {
|
||||
return {
|
||||
filters: { is_group: "No" }
|
||||
};
|
||||
});
|
||||
this.frm.set_query("sales_person", "sales_team", erpnext.queries.not_a_group_filter);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user