From 8a0031996228eae6f82088b74c738a41c47d45e5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sun, 4 Jan 2015 17:27:40 +0530 Subject: [PATCH] minor fix --- erpnext/buying/doctype/purchase_common/purchase_common.js | 3 ++- erpnext/controllers/buying_controller.py | 3 ++- erpnext/controllers/selling_controller.py | 3 ++- erpnext/selling/sales_common.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 3681081c95..9866742355 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -211,7 +211,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ var tax_count = this.frm.tax_doclist.length; this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total); - this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate); + this.frm.doc.grand_total_import = flt(tax_count ? + flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import; this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax")); diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 1e6e65d86b..f7b5a87d56 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -111,7 +111,8 @@ class BuyingController(StockController): def calculate_totals(self): self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total) - self.grand_total_import = flt(self.grand_total / self.conversion_rate) + self.grand_total_import = flt(self.grand_total / self.conversion_rate) \ + if self.tax_doclist else self.net_total_import self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax")) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 6e93c30797..68cdf189bd 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -218,7 +218,8 @@ class SellingController(StockController): def calculate_totals(self): self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total) - self.grand_total_export = flt(self.grand_total / self.conversion_rate) + self.grand_total_export = flt(self.grand_total / self.conversion_rate) \ + if self.tax_doclist else self.net_total_export self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total")) diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 783474c75f..f6d811159c 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -342,7 +342,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ var tax_count = this.frm.tax_doclist.length; this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total); - this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate); + this.frm.doc.grand_total_export = flt(tax_count ? + flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export; this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("other_charges_total"));