Merge branch 'master' into edge
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index ea6bfe2..f44a787 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -750,8 +750,9 @@
for item in self.doclist.get({"parentfield": "entries"}):
self.check_expense_account(item)
- gl_entries += self.get_gl_entries_for_stock(item.expense_account,
- -1*item.buying_amount, cost_center=item.cost_center)
+ if item.buying_amount:
+ gl_entries += self.get_gl_entries_for_stock(item.expense_account,
+ -1*item.buying_amount, cost_center=item.cost_center)
def make_pos_gl_entries(self, gl_entries):
if cint(self.doc.is_pos) and self.doc.cash_bank_account and self.doc.paid_amount:
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 90e5bdf..0019698 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -415,8 +415,9 @@
for item in self.doclist.get({"parentfield": "delivery_note_details"}):
self.check_expense_account(item)
- gl_entries += self.get_gl_entries_for_stock(item.expense_account, -1*item.buying_amount,
- cost_center=item.cost_center)
+ if item.buying_amount:
+ gl_entries += self.get_gl_entries_for_stock(item.expense_account, -1*item.buying_amount,
+ cost_center=item.cost_center)
if gl_entries:
from accounts.general_ledger import make_gl_entries