Merge branch 'edge' of github.com:webnotes/erpnext into webshop

Conflicts:
	stock/doctype/item/item.txt
This commit is contained in:
Anand Doshi
2013-05-10 18:12:24 +05:30
65 changed files with 529 additions and 184 deletions

View File

@@ -361,9 +361,13 @@ class BuyingController(StockController):
if d.item_code and d.qty:
# if no item code, which is sometimes the case in purchase invoice,
# then it is not possible to track valuation against it
d.valuation_rate = (flt(d.purchase_rate or d.rate)
+ (flt(d.item_tax_amount) + flt(d.rm_supp_cost)) / flt(d.qty)
) / flt(d.conversion_factor)
d.valuation_rate = flt((flt(d.purchase_rate, self.precision.item.purchase_rate) or
flt(d.rate, self.precision.item.rate) +
(flt(d.item_tax_amount, self.precision.item.item_tax_amount) +
flt(d.rm_supp_cost, self.precision.item.rm_supp_cost)) /
flt(d.qty, self.precision.item.qty)) /
flt(d.conversion_factor, self.precision.item.conversion_factor),
self.precision.item.valuation_rate)
else:
d.valuation_rate = 0.0

View File

@@ -60,7 +60,8 @@ class SellingController(StockController):
buying_amount = get_buying_amount(item.item_code, item.warehouse, -1*item.qty,
self.doc.doctype, self.doc.name, item.name, stock_ledger_entries,
item_sales_bom)
item.buying_amount = buying_amount > 0 and buying_amount or 0
item.buying_amount = buying_amount >= 0.01 and buying_amount or 0
webnotes.conn.set_value(item.doctype, item.name, "buying_amount",
item.buying_amount)