# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1577192497 -19800
#      Tue Dec 24 18:31:37 2019 +0530
# Node ID c970e560266a339beedd642ed3614207903462b4
# Parent  93008c916585837f7eccb79b9b7430edf59d426d
Fixed issue 42599 : Location should be updated when changing Customer/Location

diff -r 93008c916585 -r c970e560266a web/org.openbravo.retail.posterminal/js/model/order.js
--- a/web/org.openbravo.retail.posterminal/js/model/order.js	Tue Dec 24 16:30:47 2019 +0530
+++ b/web/org.openbravo.retail.posterminal/js/model/order.js	Tue Dec 24 18:31:37 2019 +0530
@@ -5469,6 +5469,7 @@
               null,
               null,
               function(shipping, billing, locations) {
+                businessPartner.set('locations', locations);
                 businessPartner.set(
                   'locationModel',
                   shipping ? shipping : billing
@@ -5518,7 +5519,7 @@
             if (callback) {
               callback();
             }
-          } else {
+          } else if (businessPartner.get(lid)) {
             OB.Dal.get(
               OB.Model.BPLocation,
               businessPartner.get(lid),
@@ -5547,6 +5548,10 @@
                 }
               }
             );
+          } else {
+            if (callback) {
+              callback();
+            }
           }
         };
 
@@ -5564,6 +5569,7 @@
             null,
             null,
             function(shipping, billing, locations) {
+              businessPartner.set('locations', locations);
               businessPartner.set(
                 'locationModel',
                 shipping ? shipping : billing
