fix: Apply shipping rule without address too

This commit is contained in:
marination 2020-06-03 14:32:07 +05:30
parent 881999d3bf
commit 0c72249403
2 changed files with 4 additions and 2 deletions

View File

@ -45,6 +45,8 @@ class ShippingRule(Document):
shipping_amount = 0.0 shipping_amount = 0.0
by_value = False by_value = False
if doc.get_shipping_address():
# validate country only if there is address
self.validate_countries(doc) self.validate_countries(doc)
if self.calculate_based_on == 'Net Total': if self.calculate_based_on == 'Net Total':

View File

@ -917,7 +917,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
shipping_rule: function() { shipping_rule: function() {
var me = this; var me = this;
if(this.frm.doc.shipping_rule && this.frm.doc.shipping_address) { if(this.frm.doc.shipping_rule) {
return this.frm.call({ return this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "apply_shipping_rule", method: "apply_shipping_rule",