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

This commit is contained in:
Akhilesh Darjee
2013-10-18 15:28:15 +05:30
8 changed files with 19 additions and 25 deletions

View File

@@ -359,6 +359,7 @@ class DocType(BuyingController):
# item gl entries
stock_item_and_auto_accounting_for_stock = False
stock_items = self.get_stock_items()
rounding_diff = 0.0
for item in self.doclist.get({"parentfield": "entries"}):
if auto_accounting_for_stock and item.item_code in stock_items:
if flt(item.valuation_rate):
@@ -367,9 +368,13 @@ class DocType(BuyingController):
# expense will be booked in sales invoice
stock_item_and_auto_accounting_for_stock = True
valuation_amt = (flt(item.amount, self.precision("amount", item)) +
valuation_amt = flt(flt(item.valuation_rate) * flt(item.qty) * \
flt(item.conversion_factor), self.precision("valuation_rate", item))
rounding_diff += (flt(item.amount, self.precision("amount", item)) +
flt(item.item_tax_amount, self.precision("item_tax_amount", item)) +
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)))
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)) -
valuation_amt)
gl_entries.append(
self.get_gl_dict({
@@ -398,6 +403,12 @@ class DocType(BuyingController):
expenses_included_in_valuation = \
self.get_company_default("expenses_included_in_valuation")
if rounding_diff:
import operator
cost_center_with_max_value = max(valuation_tax.iteritems(),
key=operator.itemgetter(1))[0]
valuation_tax[cost_center_with_max_value] -= flt(rounding_diff)
for cost_center, amount in valuation_tax.items():
gl_entries.append(
self.get_gl_dict({

View File

@@ -52,7 +52,6 @@ class DocType(SellingController):
sales_com_obj = get_obj('Sales Common')
sales_com_obj.check_stop_sales_order(self)
sales_com_obj.check_active_sales_items(self)
sales_com_obj.check_conversion_rate(self)
sales_com_obj.validate_max_discount(self, 'entries')
self.validate_customer_account()
self.validate_debit_acc()