Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Anand Doshi 2013-03-01 18:05:58 +05:30
commit 976f3b5adb
2 changed files with 11 additions and 10 deletions

View File

@ -518,16 +518,17 @@ class DocType(BuyingController):
def on_update(self):
pass
def update_raw_material_cost(self):
if self.sub_contracted_items:
for d in self.doclist.get({"parentfield": "entries"}):
rm_cost = webnotes.conn.sql(""" select raw_material_cost / quantity
from `tabBOM` where item = %s and is_default = 1 and docstatus = 1
and is_active = 1 """, (d.item_code,))
rm_cost = rm_cost and flt(rm_cost[0][0]) or 0
rm_cost = webnotes.conn.sql(""" select raw_material_cost / quantity
from `tabBOM` where item = %s and is_default = 1 and docstatus = 1
and is_active = 1 """, (d.item_code,))
rm_cost = rm_cost and flt(rm_cost[0][0]) or 0
d.conversion_factor = d.conversion_factor or webnotes.conn.get_value(
"UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom},
"conversion_factor") or 1
d.conversion_factor = d.conversion_factor or webnotes.conn.get_value(
"UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom},
"conversion_factor") or 1
d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor)
d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor)

View File

@ -290,7 +290,7 @@ class DocType(BuyingController):
self.make_gl_entries()
def validate_for_subcontracting(self):
if self.sub_contracted_items and self.purchase_items and not self.doc.is_subcontracted:
if not self.doc.is_subcontracted and self.sub_contracted_items:
webnotes.msgprint(_("""Please enter whether Purchase Recipt is made for subcontracting
or purchasing, in 'Is Subcontracted' field"""), raise_exception=1)
@ -300,7 +300,7 @@ class DocType(BuyingController):
def update_raw_materials_supplied(self):
self.doclist = self.doc.clear_table(self.doclist, 'pr_raw_material_details')
if self.sub_contracted_items:
if self.doc.is_subcontracted=="Yes":
for item in self.doclist.get({"parentfield": "purchase_receipt_details"}):
if item.item_code in self.sub_contracted_items:
self.add_bom_items(item)