From 95e35f9e81f6d0277977cbd6b4c9fbf318eade7b Mon Sep 17 00:00:00 2001 From: Anupam K Date: Tue, 24 Mar 2020 11:52:34 +0530 Subject: [PATCH 1/4] Better error message --- erpnext/utilities/transaction_base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 2099810846..46db510569 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -123,8 +123,10 @@ class TransactionBase(StatusUpdater): ref_rate = frappe.db.get_value(ref_dt + " Item", d.get(ref_link_field), "rate") if abs(flt(d.rate - ref_rate, d.precision("rate"))) >= .01: - frappe.throw(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ") + frappe.msgprint(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ") .format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate)) + frappe.throw(_("To allow different rates, disable the {0} checkbox in {1}.") + .format"Maintain Same Rate Throughout Sales Cycle",(get_link_to_form("Selling Settings","Selling Settings","Selling Settings"))) def get_link_filters(self, for_doctype): if hasattr(self, "prev_link_mapper") and self.prev_link_mapper.get(for_doctype): From b14085eb0ee60c1aa78e9d4cb12362dba095283f Mon Sep 17 00:00:00 2001 From: Anupam K Date: Tue, 24 Mar 2020 12:17:28 +0530 Subject: [PATCH 2/4] Better error message --- erpnext/utilities/transaction_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 46db510569..c52c55b68e 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe import frappe.share from frappe import _ -from frappe.utils import cstr, now_datetime, cint, flt, get_time +from frappe.utils import cstr, now_datetime, cint, flt, get_time, get_link_to_form from erpnext.controllers.status_updater import StatusUpdater from six import string_types @@ -126,7 +126,7 @@ class TransactionBase(StatusUpdater): frappe.msgprint(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ") .format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate)) frappe.throw(_("To allow different rates, disable the {0} checkbox in {1}.") - .format"Maintain Same Rate Throughout Sales Cycle",(get_link_to_form("Selling Settings","Selling Settings","Selling Settings"))) + .format("Maintain Same Rate Throughout Sales Cycle", get_link_to_form("Selling Settings","Selling Settings","Selling Settings"))) def get_link_filters(self, for_doctype): if hasattr(self, "prev_link_mapper") and self.prev_link_mapper.get(for_doctype): From 10b7a51805c6cfcbf40674dcc24423726cf58ab3 Mon Sep 17 00:00:00 2001 From: Anupam K Date: Wed, 25 Mar 2020 18:21:42 +0530 Subject: [PATCH 3/4] Better error message --- erpnext/utilities/transaction_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index c52c55b68e..779af4a2b1 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -126,7 +126,7 @@ class TransactionBase(StatusUpdater): frappe.msgprint(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ") .format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate)) frappe.throw(_("To allow different rates, disable the {0} checkbox in {1}.") - .format("Maintain Same Rate Throughout Sales Cycle", get_link_to_form("Selling Settings","Selling Settings","Selling Settings"))) + .format(frappe.bold("Maintain Same Rate Throughout Sales Cycle"), get_link_to_form("Selling Settings","Selling Settings",frappe.bold("Selling Settings")))) def get_link_filters(self, for_doctype): if hasattr(self, "prev_link_mapper") and self.prev_link_mapper.get(for_doctype): From 9062ce5191064e76150fd15f364dca5a0f734fa7 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Thu, 26 Mar 2020 11:56:03 +0530 Subject: [PATCH 4/4] fix: Spacing and indentations --- erpnext/utilities/transaction_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 779af4a2b1..f88ffd44e3 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -126,7 +126,8 @@ class TransactionBase(StatusUpdater): frappe.msgprint(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ") .format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate)) frappe.throw(_("To allow different rates, disable the {0} checkbox in {1}.") - .format(frappe.bold("Maintain Same Rate Throughout Sales Cycle"), get_link_to_form("Selling Settings","Selling Settings",frappe.bold("Selling Settings")))) + .format(frappe.bold("Maintain Same Rate Throughout Sales Cycle"), + get_link_to_form("Selling Settings", "Selling Settings", frappe.bold("Selling Settings")))) def get_link_filters(self, for_doctype): if hasattr(self, "prev_link_mapper") and self.prev_link_mapper.get(for_doctype):