Fix price levels returning empty in offline mode

CalculatePriceLevels now falls back to localDB when pricelistRepo is nil
(offline mode) to resolve the latest pricelist ID per source. Previously
all price lookups were skipped, resulting in empty prices on the pricing tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 12:47:32 +03:00
parent 65db9b37ea
commit 2f0957ae4e

View File

@@ -289,6 +289,13 @@ func (s *QuoteService) CalculatePriceLevels(req *PriceLevelsRequest) (*PriceLeve
result.ResolvedPricelistIDs[sourceKey] = latest.ID result.ResolvedPricelistIDs[sourceKey] = latest.ID
} }
} }
if st.id == 0 && s.localDB != nil {
localPL, err := s.localDB.GetLatestLocalPricelistBySource(sourceKey)
if err == nil && localPL != nil {
st.id = localPL.ServerID
result.ResolvedPricelistIDs[sourceKey] = localPL.ServerID
}
}
if st.id == 0 { if st.id == 0 {
continue continue
} }