mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +00:00
fixes for gl entries in purchase invoice
This commit is contained in:
@@ -451,7 +451,7 @@ class DocType(BuyingController):
|
|||||||
# item gl entries
|
# item gl entries
|
||||||
stock_item_and_auto_accounting = False
|
stock_item_and_auto_accounting = False
|
||||||
for item in self.doclist.get({"parentfield": "entries"}):
|
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":
|
webnotes.conn.get_value("Item", item.item_code, "is_stock_item")=="Yes":
|
||||||
# if auto inventory accounting enabled and stock item,
|
# if auto inventory accounting enabled and stock item,
|
||||||
# then do stock related gl entries, expense will be booked in sales invoice
|
# 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
|
stock_item_and_auto_accounting = True
|
||||||
|
|
||||||
else:
|
elif flt(item.amount):
|
||||||
# if not a stock item or auto inventory accounting disabled, book the expense
|
# if not a stock item or auto inventory accounting disabled, book the expense
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
|
|||||||
@@ -664,6 +664,7 @@ class DocType(SellingController):
|
|||||||
# item gl entries
|
# item gl entries
|
||||||
for item in getlist(self.doclist, 'entries'):
|
for item in getlist(self.doclist, 'entries'):
|
||||||
# income account gl entries
|
# income account gl entries
|
||||||
|
if flt(item.amount):
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": item.income_account,
|
"account": item.income_account,
|
||||||
@@ -682,6 +683,7 @@ class DocType(SellingController):
|
|||||||
item.dn_detail, "purchase_rate")
|
item.dn_detail, "purchase_rate")
|
||||||
valuation_amount = purchase_rate * item.qty
|
valuation_amount = purchase_rate * item.qty
|
||||||
# expense account gl entries
|
# expense account gl entries
|
||||||
|
if flt(valuation_amount):
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": item.expense_account,
|
"account": item.expense_account,
|
||||||
|
|||||||
Reference in New Issue
Block a user