From 6c9c3426f8175e756e806ac79485282a5499b0d4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 20 Jun 2023 07:23:51 +0530 Subject: [PATCH] refactor: allow '0' rounding allowance (cherry picked from commit 4567474418d159e6334c7b69c3a7f7f6ccc9741d) --- .../exchange_rate_revaluation/exchange_rate_revaluation.js | 4 ++-- .../exchange_rate_revaluation/exchange_rate_revaluation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js index 733a7616b21..1ef5c837402 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js @@ -36,8 +36,8 @@ frappe.ui.form.on('Exchange Rate Revaluation', { }, validate_rounding_loss: function(frm) { - allowance = frm.doc.rounding_loss_allowance; - if (!(allowance > 0 && allowance < 1)) { + let allowance = frm.doc.rounding_loss_allowance; + if (!(allowance >= 0 && allowance < 1)) { frappe.throw(__("Rounding Loss Allowance should be between 0 and 1")); } }, diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py index 2e2a34ad835..b161cc7fcc4 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py @@ -22,7 +22,7 @@ class ExchangeRateRevaluation(Document): self.set_total_gain_loss() def validate_rounding_loss_allowance(self): - if not (self.rounding_loss_allowance > 0 and self.rounding_loss_allowance < 1): + if not (self.rounding_loss_allowance >= 0 and self.rounding_loss_allowance < 1): frappe.throw(_("Rounding Loss Allowance should be between 0 and 1")) def set_total_gain_loss(self):