async void setLocation(InvWarehouse master, DebtorOrderLineClient rec)
 {
     if (api.CompanyEntity.Location)
     {
         if (master != null)
         {
             rec.locationSource = master.Locations ?? await master.LoadLocations(api);
         }
         else
         {
             rec.locationSource = null;
             rec.Location       = null;
         }
         rec.NotifyPropertyChanged("LocationSource");
     }
 }
        async void setSerieBatchSource(DebtorOrderLineClient row)
        {
            var cache         = api.CompanyEntity.GetCache(typeof(InvItem));
            var invItemMaster = cache.Get(row._Item) as InvItem;

            if (invItemMaster == null)
            {
                return;
            }
            if (row.SerieBatches != null && row.SerieBatches.First()._Item == row._Item)/*Bind if Item changed*/
            {
                return;
            }
            List <UnicontaBaseEntity> masters = null;

            if (row._Qty < 0)
            {
                masters = new List <UnicontaBaseEntity>()
                {
                    invItemMaster
                };
            }
            else
            {
                // We only select opens
                var mast = new InvSerieBatchOpen();
                mast.SetMaster(invItemMaster);
                masters = new List <UnicontaBaseEntity>()
                {
                    mast
                };
            }
            var res = await api.Query <SerialToOrderLineClient>(masters, null);

            if (res != null && res.Length > 0)
            {
                row.SerieBatches = res;
                row.NotifyPropertyChanged("SerieBatches");
            }
        }