Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2013-07-29 15:30:23 +05:30
commit 29bec06f2c
6 changed files with 40 additions and 32 deletions

View File

@ -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" }});

View File

@ -169,15 +169,13 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
if(length(tabItem.description) > 40, \
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
from tabItem
where tabItem.docstatus!=2
and (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00")
or `tabItem`.`end_of_life` > NOW())
where tabItem.docstatus<2
and (tabItem.%(key)s LIKE "%(txt)s"
or tabItem.item_name LIKE "%(txt)s")
%(fcond)s %(mcond)s
limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
'fcond': get_filters_cond(doctype, filters, conditions),
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond': get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
def bom(doctype, txt, searchfield, start, page_len, filters):
conditions = []

View File

@ -0,0 +1,9 @@
import webnotes
def execute():
for price_list_name in webnotes.conn.sql_list("""select name from `tabPrice List`
where ifnull(currency, '')=''"""):
res = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price`
where price_list_name=%s""", price_list_name)
if res and len(res)==1 and res[0][0]:
webnotes.conn.set_value("Price List", price_list_name, "currency", res[0][0])

View File

@ -262,5 +262,6 @@ patch_list = [
"patches.july_2013.p08_custom_print_format_net_total_export",
"patches.july_2013.p09_remove_website_pyc",
"patches.july_2013.p10_change_partner_user_to_website_user",
"execute:webnotes.bean('Selling Settings').save()",
"patches.july_2013.p11_update_price_list_currency",
"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
]

View File

@ -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" } };
},

View File

@ -36,21 +36,14 @@ 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) {
@ -64,12 +57,6 @@ 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);
}
},