Merge branch 'master' of github.com:webnotes/erpnext into shf_merge
This commit is contained in:
commit
3107096890
@ -254,7 +254,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
// Item Code
|
// Item Code
|
||||||
// ----------
|
// ----------
|
||||||
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Credit To
|
// Credit To
|
||||||
|
@ -162,7 +162,11 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
|
|||||||
//==================== Item Code Get Query =======================================================
|
//==================== Item Code Get Query =======================================================
|
||||||
// Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed.
|
// Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed.
|
||||||
cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
if (doc.is_subcontracted =="Yes") {
|
||||||
|
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_sub_contracted_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
||||||
|
} else {
|
||||||
|
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================== Get Item Code Details =====================================================
|
//==================== Get Item Code Details =====================================================
|
||||||
|
@ -59,8 +59,7 @@ class DocType:
|
|||||||
self.validate_item(s[0], count)
|
self.validate_item(s[0], count)
|
||||||
self.validate_warehouse(s[1], count)
|
self.validate_warehouse(s[1], count)
|
||||||
|
|
||||||
# encode as ascii
|
self.data.append(s)
|
||||||
self.data.append([d.encode("ascii") for d in s])
|
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if not self.validated:
|
if not self.validated:
|
||||||
@ -76,7 +75,8 @@ class DocType:
|
|||||||
|
|
||||||
def validate_item(self, item, count):
|
def validate_item(self, item, count):
|
||||||
""" Validate item exists and non-serialized"""
|
""" Validate item exists and non-serialized"""
|
||||||
det = sql("select item_code, has_serial_no from `tabItem` where name = '%s'"% cstr(item), as_dict = 1)
|
det = sql("select item_code, has_serial_no from `tabItem` \
|
||||||
|
where name = %s", cstr(item), as_dict = 1)
|
||||||
if not det:
|
if not det:
|
||||||
msgprint("Item: " + cstr(item) + " mentioned at Row No. " + cstr(count) + "does not exist in the system")
|
msgprint("Item: " + cstr(item) + " mentioned at Row No. " + cstr(count) + "does not exist in the system")
|
||||||
self.validated = 0
|
self.validated = 0
|
||||||
@ -89,7 +89,7 @@ class DocType:
|
|||||||
|
|
||||||
def validate_warehouse(self, wh, count,):
|
def validate_warehouse(self, wh, count,):
|
||||||
"""Validate warehouse exists"""
|
"""Validate warehouse exists"""
|
||||||
if not sql("select name from `tabWarehouse` where name = '%s'" % cstr(wh)):
|
if not sql("select name from `tabWarehouse` where name = %s", cstr(wh)):
|
||||||
msgprint("Warehouse: " + cstr(wh) + " mentioned at Row No. " + cstr(count) + " does not exist in the system")
|
msgprint("Warehouse: " + cstr(wh) + " mentioned at Row No. " + cstr(count) + " does not exist in the system")
|
||||||
self.validated = 0
|
self.validated = 0
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ class DocType:
|
|||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def get_bin(self, item_code):
|
def get_bin(self, item_code):
|
||||||
bin = sql("select name from tabBin where item_code = '%s' and warehouse = '%s'" % (item_code, self.doc.name))
|
bin = sql("select name from tabBin where item_code = %s and \
|
||||||
|
warehouse = %s", (item_code, self.doc.name))
|
||||||
bin = bin and bin[0][0] or ''
|
bin = bin and bin[0][0] or ''
|
||||||
if not bin:
|
if not bin:
|
||||||
if not self.doc.warehouse_type :
|
if not self.doc.warehouse_type :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user