From 0b9ec8cbc15afc96db99977fb17c81428056f3f6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 3 Apr 2013 13:45:28 +0530 Subject: [PATCH] [auto inventory accounting] [fix] if non stock item, dont create gl entry in delivery note and pos sales invoice --- accounts/doctype/sales_invoice/sales_invoice.py | 5 +++-- stock/doctype/delivery_note/delivery_note.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 9b17fc0e61..1003a8ec22 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -749,8 +749,9 @@ class DocType(SellingController): 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 daf7d61519..ab7d060859 100644 --- a/stock/doctype/delivery_note/delivery_note.py +++ b/stock/doctype/delivery_note/delivery_note.py @@ -413,8 +413,9 @@ class DocType(SellingController): 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