fixes for gl entries in purchase invoice

This commit is contained in:
Nabin Hait 2013-02-01 17:03:05 +05:30
parent 1a2974c53d
commit 982a0a0e0a
2 changed files with 29 additions and 27 deletions

View File

@ -451,7 +451,7 @@ class DocType(BuyingController):
# item gl entries
stock_item_and_auto_accounting = False
for item in self.doclist.get({"parentfield": "entries"}):
if auto_inventory_accounting and \
if auto_inventory_accounting and flt(item.valuation_rate) and \
webnotes.conn.get_value("Item", item.item_code, "is_stock_item")=="Yes":
# if auto inventory accounting enabled and stock item,
# then do stock related gl entries, expense will be booked in sales invoice
@ -467,7 +467,7 @@ class DocType(BuyingController):
stock_item_and_auto_accounting = True
else:
elif flt(item.amount):
# if not a stock item or auto inventory accounting disabled, book the expense
gl_entries.append(
self.get_gl_dict({

View File

@ -664,6 +664,7 @@ class DocType(SellingController):
# item gl entries
for item in getlist(self.doclist, 'entries'):
# income account gl entries
if flt(item.amount):
gl_entries.append(
self.get_gl_dict({
"account": item.income_account,
@ -682,6 +683,7 @@ class DocType(SellingController):
item.dn_detail, "purchase_rate")
valuation_amount = purchase_rate * item.qty
# expense account gl entries
if flt(valuation_amount):
gl_entries.append(
self.get_gl_dict({
"account": item.expense_account,