Merge branch 'master' into responsive

This commit is contained in:
Rushabh Mehta 2013-04-26 13:20:39 +05:30
commit 9c0ccdef26
3 changed files with 25 additions and 19 deletions

View File

@ -32,7 +32,7 @@ class DocType:
def autoname(self): def autoname(self):
last_name = sql("""select max(name) from `tabBOM` last_name = sql("""select max(name) from `tabBOM`
where name like 'BOM/%s/%%'""" % self.doc.item) where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
if last_name: if last_name:
idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1 idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
else: else:
@ -67,16 +67,16 @@ class DocType:
self.manage_default_bom() self.manage_default_bom()
def get_item_det(self, item_code): def get_item_det(self, item_code):
item = sql("""select name, is_asset_item, is_purchase_item, docstatus, description, item = webnotes.conn.sql("""select name, is_asset_item, is_purchase_item,
is_sub_contracted_item, stock_uom, default_bom, docstatus, description, is_sub_contracted_item, stock_uom, default_bom,
last_purchase_rate, standard_rate, is_manufactured_item last_purchase_rate, standard_rate, is_manufactured_item
from `tabItem` where item_code = %s""", item_code, as_dict = 1) from `tabItem` where name=%s""", item_code, as_dict = 1)
return item return item
def get_item_details(self, item_code): def get_item_details(self, item_code):
res = sql("""select description, stock_uom as uom res = webnotes.conn.sql("""select description, stock_uom as uom
from `tabItem` where item_code = %s""", item_code, as_dict = 1) from `tabItem` where name=%s""", item_code, as_dict = 1)
return res and res[0] or {} return res and res[0] or {}
def get_workstation_details(self,workstation): def get_workstation_details(self,workstation):
@ -209,7 +209,7 @@ class DocType:
msgprint("""Operation no: %s against item: %s at row no: %s \ msgprint("""Operation no: %s against item: %s at row no: %s \
is not present at Operations table""" % is not present at Operations table""" %
(m.operation_no, m.item_code, m.idx), raise_exception = 1) (m.operation_no, m.item_code, m.idx), raise_exception = 1)
item = self.get_item_det(m.item_code) item = self.get_item_det(m.item_code)
if item[0]['is_manufactured_item'] == 'Yes': if item[0]['is_manufactured_item'] == 'Yes':
if not m.bom_no: if not m.bom_no:

Binary file not shown.

View File

@ -29,12 +29,12 @@ class DocType:
def get_transactions(self, arg=None): def get_transactions(self, arg=None):
return { return {
"transactions": "\n".join([''] + [i[0] for i in "transactions": "\n".join([''] + sorted(list(set(
sql("""select `tabDocField`.`parent` webnotes.conn.sql_list("""select parent
FROM `tabDocField`, `tabDocType` from `tabDocField` where fieldname='naming_series'""")
WHERE `tabDocField`.`fieldname` = 'naming_series' + webnotes.conn.sql_list("""select dt from `tabCustom Field`
and `tabDocType`.name=`tabDocField`.parent where fieldname='naming_series'""")
order by `tabDocField`.parent""")]), )))),
"prefixes": "\n".join([''] + [i[0] for i in "prefixes": "\n".join([''] + [i[0] for i in
sql("""select name from tabSeries""")]) sql("""select name from tabSeries""")])
} }
@ -89,7 +89,6 @@ class DocType:
'property': prop, 'property': prop,
'value': prop_dict[prop], 'value': prop_dict[prop],
'property_type': 'Select', 'property_type': 'Select',
'select_doctype': doctype
}) })
ps.save(1) ps.save(1)
@ -101,11 +100,18 @@ class DocType:
from core.doctype.doctype.doctype import DocType from core.doctype.doctype.doctype import DocType
dt = DocType() dt = DocType()
parent = sql("""select dt.name from `tabDocField` df, `tabDocType` dt parent = list(set(
where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""", webnotes.conn.sql_list("""select dt.name
self.doc.select_doc_for_series) from `tabDocField` df, `tabDocType` dt
sr = ([webnotes.model.doctype.get_property(p[0], 'options', 'naming_series'), p[0]] where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""",
for p in parent) self.doc.select_doc_for_series)
+ webnotes.conn.sql_list("""select dt.name
from `tabCustom Field` df, `tabDocType` dt
where dt.name = df.dt and df.fieldname='naming_series' and dt.name != %s""",
self.doc.select_doc_for_series)
))
sr = [[webnotes.model.doctype.get_property(p, 'options', 'naming_series'), p]
for p in parent]
options = self.scrub_options_list(self.doc.set_options.split("\n")) options = self.scrub_options_list(self.doc.set_options.split("\n"))
for series in options: for series in options:
dt.validate_series(series, self.doc.select_doc_for_series) dt.validate_series(series, self.doc.select_doc_for_series)