Merge branch 'shf_rename'

This commit is contained in:
Anand Doshi 2012-05-16 12:28:14 +05:30
commit c51c0d38d7
2 changed files with 17 additions and 15 deletions

View File

@ -34,18 +34,20 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType: class DocType:
def __init__(self,doc,doclist=[]): def __init__(self,doc,doclist=[]):
self.doc, self.doclist = doc,doclist self.doc, self.doclist = doc,doclist
#--------------------get naming series from sales invoice----------------- #--------------------get naming series from sales invoice-----------------
def get_series(self): def get_series(self):
res = sql("select options from `tabDocField` where parent='Sales Invoice' and fieldname = 'naming_series'") import webnotes.model.doctype
return res and cstr(res[0][0]) or '' docfield = webnotes.model.doctype.get('Sales Invoice')
series = [d.options for d in docfield if d.doctype == 'DocField' and d.fieldname == 'naming_series']
def validate(self): return series and series[0] or ''
res = sql("select name, user from `tabPOS Setting` where ifnull(user, '') = '%s' and name != '%s' and company = '%s'" % (self.doc.user, self.doc.name, self.doc.company))
if res: def validate(self):
if res[0][1]: res = sql("select name, user from `tabPOS Setting` where ifnull(user, '') = '%s' and name != '%s' and company = '%s'" % (self.doc.user, self.doc.name, self.doc.company))
msgprint("POS Setting '%s' already created for user: '%s' and company: '%s'"%(res[0][0], res[0][1], self.doc.company), raise_exception=1) if res:
else: if res[0][1]:
msgprint("Global POS Setting already created - %s for this company: '%s'" % (res[0][0], self.doc.company), raise_exception=1) msgprint("POS Setting '%s' already created for user: '%s' and company: '%s'"%(res[0][0], res[0][1], self.doc.company), raise_exception=1)
else:
msgprint("Global POS Setting already created - %s for this company: '%s'" % (res[0][0], self.doc.company), raise_exception=1)

View File

@ -268,7 +268,7 @@ cur_frm.cscript.import_ref_rate = function(doc, cdt, cdn) {
var is_item_table = function(doc,cdt,cdn) { var is_item_table = function(doc,cdt,cdn) {
// Step 1 :=>Get all childrens/ rows from Detail Table // Step 1 :=>Get all childrens/ rows from Detail Table
var cl = getchildren(tname, doc.name, fname); var cl = getchildren(tname, doc.name, fname);
// Step 2 :=> If there are no rows then set validated = false, I hope this will stop further execution of code. // Step 2 :=> If there are no rows then set validated = false, this will stop further execution of code.
if (cl.length == 0) { if (cl.length == 0) {
alert("There is no item in table"); validated = false; alert("There is no item in table"); validated = false;
} }