Kaynağa Gözat

Tweak to requisition store

Kenric Nugteren 1 yıl önce
ebeveyn
işleme
9f97bac17d
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      prs.stores/RequisitionStore.cs

+ 3 - 1
prs.stores/RequisitionStore.cs

@@ -301,7 +301,9 @@ namespace Comal.Stores
                 var txnid = Guid.NewGuid();
                 if(holdingQty < qty)
                 {
-                    var extraRequired = qty - holdingQty;
+                    // Don't pull more than the required quantity, meaning if the holding is negative, it will remain negative.
+                    var extraRequired = Math.Max(qty - holdingQty, qty);
+
                     // We don't have enough stock in this case, so transfer the necessary stock from general. We don't check for quantity in general stock,
                     // but instead will let general stock go negative if not enough. Obviously we have the stock, because its being sent to site. So if we do
                     // get negatives, it means probably our number are wrong I think.