From 3e84ab1349cd798608145bc0f81db00081266239 Mon Sep 17 00:00:00 2001 From: Marica Date: Thu, 9 Apr 2020 12:01:10 +0530 Subject: [PATCH] fix: Error on any new doc from Shipping Rule. (#21206) --- erpnext/accounts/doctype/shipping_rule/shipping_rule.py | 2 +- erpnext/public/js/controllers/transaction.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py index 1fd340c731..b2638c7827 100644 --- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py @@ -82,7 +82,7 @@ class ShippingRule(Document): if not shipping_country: frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule')) if shipping_country not in [d.country for d in self.countries]: - frappe.throw(_('Shipping rule not applicable for country {0}').format(shipping_country)) + frappe.throw(_('Shipping rule not applicable for country {0} in Shipping Address').format(shipping_country)) def add_shipping_rule_to_tax_table(self, doc, shipping_amount): shipping_charge = { diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2c436b2bde..0c63c33f7a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -894,7 +894,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ shipping_rule: function() { var me = this; - if(this.frm.doc.shipping_rule) { + if(this.frm.doc.shipping_rule && this.frm.doc.shipping_address) { return this.frm.call({ doc: this.frm.doc, method: "apply_shipping_rule",