Optimize stock availability query and fix configuration issues#227
Closed
Kushalnahata17 wants to merge 6 commits intoBrainWise-DEV:developfrom
Closed
Optimize stock availability query and fix configuration issues#227Kushalnahata17 wants to merge 6 commits intoBrainWise-DEV:developfrom
Kushalnahata17 wants to merge 6 commits intoBrainWise-DEV:developfrom
Conversation
…tion lodash 4.18.0 removed `assignWith` from template scope, breaking workbox-build's SW template compilation during `bench build`. https://claude.ai/code/session_01HwkTrrrzwXWuoNfGnFtCQr
Remove commented-out code and duplicate import left by 755e02b, keeping the optimized SQL-based get_stock_availability function. https://claude.ai/code/session_01HwkTrrrzwXWuoNfGnFtCQr
- Add missing "variant_of" field to ITEM_RESULT_FIELDS - Use Query Builder (frappe.qb) instead of raw SQL for get_stock_availability to match BrainWise-DEV:develop https://claude.ai/code/session_01HwkTrrrzwXWuoNfGnFtCQr
engahmed1190
reviewed
Apr 1, 2026
Contributor
engahmed1190
left a comment
There was a problem hiding this comment.
Code Review — CLOSE (All changes already on develop)
All three changes in this PR are already present on develop:
-
pos_next/api/items.py— Thevariant_offield addition toITEM_RESULT_FIELDSand thefrappe.qbstock query refactor were merged in prior work. The file ondevelopis identical to this PR's version. -
pyproject.toml— The malformed quote fix and[tool.bench.frappe-dependencies]section are already ondevelop. -
POS/package.json— The lodash resolution is already present ondevelop.
Diffing this PR's HEAD against develop produces zero differences across all three files. The PR's merge state is UNSTABLE because there's nothing left to merge.
Recommend closing as superseded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR optimizes the stock availability lookup query and fixes configuration issues in the project setup files.
Key Changes
Stock Availability Query Optimization (
pos_next/api/items.py)frappe.get_all()tofrappe.db.sql()for improved performance when querying stock levels across multiple warehousesactual_qtymight be nullfltutility function fromfrappe.utilsConfiguration Fixes
POS/package.jsonto address potential security or compatibility concernsImplementation Details
The stock availability query now uses raw SQL with parameterized queries for better performance when dealing with group warehouses that may have many child warehouses. The query aggregates stock quantities at the database level rather than in application code, reducing memory overhead and improving response times.
https://claude.ai/code/session_01HwkTrrrzwXWuoNfGnFtCQr