[fixes] bom autoname

This commit is contained in:
Nabin Hait 2013-05-10 11:11:46 +05:30
parent 0f5872b342
commit e762b264b1

View File

@ -34,7 +34,8 @@ class DocType:
last_name = sql("""select max(name) from `tabBOM`
where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
if last_name:
idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
else:
idx = 1
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)