From 3ccd07cc725401435bc56c0ddefefe9a9c4d5f47 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Aug 2013 15:21:25 +0530 Subject: [PATCH] [fix] [minor] paid amount should be zero if not pos invoice --- .../doctype/sales_invoice/sales_invoice.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 904f31b7f5..8a67f88415 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -509,20 +509,20 @@ class DocType(SellingController): if not d.warehouse: d.warehouse = cstr(w) - if flt(self.doc.paid_amount) == 0: - if self.doc.cash_bank_account: - webnotes.conn.set(self.doc, 'paid_amount', - (flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) - else: - # show message that the amount is not paid - webnotes.conn.set(self.doc,'paid_amount',0) - webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.") - self.make_packing_list() else: self.doclist = self.doc.clear_table(self.doclist, 'packing_details') - if not cint(self.doc.is_pos): + if cint(self.doc.is_pos) == 1: + if flt(self.doc.paid_amount) == 0: + if self.doc.cash_bank_account: + webnotes.conn.set(self.doc, 'paid_amount', + (flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) + else: + # show message that the amount is not paid + webnotes.conn.set(self.doc,'paid_amount',0) + webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.") + else: webnotes.conn.set(self.doc,'paid_amount',0) def check_prev_docstatus(self):