main stocks update

This commit is contained in:
2026-07-27 19:00:09 +05:30
parent 8885c55817
commit eb6e750b6a
6 changed files with 200 additions and 117 deletions

View File

@@ -757,7 +757,12 @@ export function useFiestaGetStockRequests(opts: {
return useQuery({
queryKey: fiestaKeys.stockRequests(opts),
queryFn: () => getStockRequests(opts),
enabled: Boolean(opts.tenantid),
// Omitting locationid is a deliberate tenant-wide query (the admin console
// needs every outlet's requests). But passing an EMPTY one is not: the
// backend treats locationid=0 as "no filter" and returns every outlet, so a
// store user whose outlet hasn't resolved yet would see other stores'
// requests. Wait for a real id in that case.
enabled: Boolean(opts.tenantid) && (opts.locationid === undefined || Boolean(opts.locationid)),
});
}