Merge branch 'master' into edge

Conflicts:
	home/page/latest_updates/latest_updates.js
	hr/doctype/employee/employee.txt
This commit is contained in:
Anand Doshi
2013-04-16 21:32:06 +05:30
22 changed files with 465 additions and 167 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2012-02-02 11:50:33",
"docstatus": 0,
"modified": "2013-04-05 16:08:22",
"modified": "2013-04-16 12:26:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -60,6 +60,13 @@
"match_id": 1,
"to_field": "dn_detail"
},
{
"doctype": "Field Mapper Detail",
"from_field": "eval: flt(obj.qty) - flt(obj.packed_qty)",
"map": "Yes",
"match_id": 1,
"to_field": "qty"
},
{
"doctype": "Table Mapper Detail",
"from_table": "Delivery Note",

View File

@@ -39,7 +39,8 @@ class DocType(DocListController):
# webpage updates
self.update_website()
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
bin = sql("select stock_uom from `tabBin` where item_code = %s",
self.doc.item_code)
if bin and cstr(bin[0][0]) and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
raise Exception
@@ -149,7 +150,7 @@ class DocType(DocListController):
def check_for_active_boms(self, field_label):
if field_label in ['Is Active', 'Is Purchase Item']:
bom_mat = sql("select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 where t1.item_code ='%s' and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 1 and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
bom_mat = sql("select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 where t1.item_code =%s and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 1 and t2.docstatus = 1 and t1.docstatus =1 ", self.doc.name)
if bom_mat and bom_mat[0][0]:
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
raise Exception
@@ -157,7 +158,7 @@ class DocType(DocListController):
and self.doc.is_sub_contracted_item != 'Yes')
or (field_label == 'Is Sub Contracted Item'
and self.doc.is_manufactured_item != 'Yes')):
bom = sql("select name from `tabBOM` where item = '%s' and is_active = 1" % cstr(self.doc.name))
bom = sql("select name from `tabBOM` where item = %s and is_active = 1", self.doc.name)
if bom and bom[0][0]:
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
raise Exception
@@ -242,7 +243,7 @@ class DocType(DocListController):
if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or
vals.has_serial_no != self.doc.has_serial_no or
vals.valuation_method != self.doc.valuation_method):
if self.check_if_sle_exists():
if self.check_if_sle_exists() == "exists":
webnotes.msgprint(_("As there are existing stock transactions for this \
item, you can not change the values of 'Has Serial No', \
'Is Stock Item' and 'Valuation Method'"), raise_exception=1)

View File

@@ -185,17 +185,6 @@ class DocType:
def set_item_details(self, row):
res = webnotes.conn.sql("""SELECT item_name, SUM(IFNULL(qty, 0)) as total_qty,
IFNULL(packed_qty, 0) as packed_qty, stock_uom
FROM `tabDelivery Note Item`
WHERE parent=%s AND item_code=%s GROUP BY item_code""",
(self.doc.delivery_note, row.item_code), as_dict=1)
if res and len(res)>0:
qty = res[0]['total_qty'] - res[0]['packed_qty']
if not row.qty:
row.qty = qty >= 0 and qty or 0
res = webnotes.conn.sql("""SELECT net_weight, weight_uom FROM `tabItem`
WHERE name=%s""", row.item_code, as_dict=1)