From 2f8d4451f5a7d5edd7b573bd3ea9c7fe375c901d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 20 Feb 2014 14:59:37 +0530 Subject: [PATCH] calculate outstanding amount in server side, only if docstatus is 0 --- erpnext/controllers/buying_controller.py | 2 +- erpnext/controllers/selling_controller.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 21c85b7265..af05a7e52c 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -139,7 +139,7 @@ class BuyingController(StockController): self.doc.conversion_rate, self.precision("other_charges_deducted_import")) def calculate_outstanding_amount(self): - if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus < 2: + if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus == 0: self.doc.total_advance = flt(self.doc.total_advance, self.precision("total_advance")) self.doc.total_amount_to_pay = flt(self.doc.grand_total - flt(self.doc.write_off_amount, diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 962a182f41..e25fe1752e 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -222,7 +222,7 @@ class SellingController(StockController): # NOTE: # write_off_amount is only for POS Invoice # total_advance is only for non POS Invoice - if self.doc.doctype == "Sales Invoice" and self.doc.docstatus < 2: + if self.doc.doctype == "Sales Invoice" and self.doc.docstatus == 0: self.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount", "paid_amount"]) total_amount_to_pay = self.doc.grand_total - self.doc.write_off_amount