Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize DB calls with frappe.get_all #45289

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

Sanket322
Copy link
Contributor

Replaced multiple calls to frappe.db.get_value for fetching individual items with a single call to frappe.get_all.

@github-actions github-actions bot added needs-tests This PR needs automated unit-tests. selling labels Jan 16, 2025
@gavindsouza gavindsouza removed the needs-tests This PR needs automated unit-tests. label Jan 17, 2025
@nabinhait nabinhait merged commit 2a400dd into frappe:develop Jan 23, 2025
13 checks passed
mergify bot pushed a commit that referenced this pull request Jan 23, 2025
* perf: reduce multiple db queries

* fix: use frappe._dict instread of extra iteration

---------

Co-authored-by: Sanket322 <shahsanket322003.com>
(cherry picked from commit 2a400dd)
nabinhait pushed a commit that referenced this pull request Jan 23, 2025
perf: optimize DB calls with frappe.get_all (#45289)

* perf: reduce multiple db queries

* fix: use frappe._dict instread of extra iteration

---------

Co-authored-by: Sanket322 <shahsanket322003.com>
(cherry picked from commit 2a400dd)

Co-authored-by: Sanket Shah <[email protected]>
frappe-pr-bot pushed a commit that referenced this pull request Jan 29, 2025
# [15.50.0](v15.49.3...v15.50.0) (2025-01-29)

### Bug Fixes

* add condition to check if item is delivered by supplier in make_purchase_order_for_default_supplier() (backport [#45370](#45370)) ([#45410](#45410)) ([5d7d3d8](5d7d3d8))
* add multiple item issue in stock entry (backport [#45544](#45544)) ([#45580](#45580)) ([8b0efab](8b0efab))
* added debounce to prevent multiple clicks (backport [#45369](#45369)) ([#45376](#45376)) ([bdc65da](bdc65da))
* added item_group filter in item_code field in stock balance report (backport [#45340](#45340)) ([#45389](#45389)) ([412e22f](412e22f))
* allow to fix negative stock for batch using stock reco ([69c5695](69c5695))
* batch qty calculation (backport [#45367](#45367)) ([#45388](#45388)) ([767529f](767529f))
* Correct Party Bank Account mapping in `Payment Entry` ([4a390ae](4a390ae))
* currency decimal on POS Past Order List (backport [#45524](#45524)) ([#45527](#45527)) ([ff46ae5](ff46ae5))
* disable load_after_mapping when purchase order created from sales order (backport [#45405](#45405)) ([#45429](#45429)) ([ae5ce97](ae5ce97))
* Do no query GLs if no PCVs are posted ([ad06652](ad06652))
* do not allow to manually submit the SABB ([2b16eb5](2b16eb5))
* do not check budget during reposting ([#45432](#45432)) ([f2b946d](f2b946d))
* don't update party-type on change of cost center in Journal Entry ([#45291](#45291)) ([fb75180](fb75180))
* existing logical error ([6c4655d](6c4655d))
* fix creating documents from sales invoice (backport [#45346](#45346)) ([#45408](#45408)) ([73a21c2](73a21c2))
* get stock balance filtered by company for validating stock value in jv (backport [#45549](#45549)) ([#45578](#45578)) ([ef2f411](ef2f411))
* import ([d74c498](d74c498))
* import 2 ([b59d253](b59d253))
* JobCardTimeLog' object has no attribute 'remaining_time_in_mins' ([ef15429](ef15429))
* logical error in where condition of qb query ([c102e51](c102e51))
* **material request:** mapping Sales Order Item Delivery Date to Mate… (backport [#45227](#45227)) ([#45424](#45424)) ([52fdc7c](52fdc7c))
* merge conflict ([57f79a2](57f79a2))
* **payment entry:** get amount in transaction currency ([b37602c](b37602c))
* postal_code_move_and_fixes ([0e088dd](0e088dd))
* precision issue causing incorrect status ([46a2b7a](46a2b7a))
* precision issue in stock entry ([fe5e42d](fe5e42d))
* **query:** remove duplicate docstatus condition ([#45586](#45586)) ([2d2f30e](2d2f30e))
* remove applied pricing rule ([4e347d8](4e347d8))
* remove unnecessary auth from plaid connector (backport [#44305](#44305)) ([#45421](#45421)) ([d9b342f](d9b342f))
* removed field not present in v15 ([1be1981](1be1981))
* resolved pos return setting to default mode of payment instead of user selection (backport [#45377](#45377)) ([#45419](#45419)) ([224a925](224a925))
* return qty error due to precision (backport [#45536](#45536)) ([#45581](#45581)) ([a2ffdc7](a2ffdc7))
* secure bulk transaction (backport [#45386](#45386)) ([#45426](#45426)) ([f9d9672](f9d9672))
* set company related values ([1498275](1498275))
* set expense_account and cost_center based on company in stock entry (backport [#45159](#45159)) ([#45416](#45416)) ([3eb28bb](3eb28bb))
* set party_account_currency for pos_invoice returns ([172fdad](172fdad))
* set preferred email in Employee via backend controller (backport [#45320](#45320)) ([#45379](#45379)) ([f8099a6](f8099a6))
* Set right party name in bank transaction ([86f4bf6](86f4bf6))
* show payment entries in Tax Withheld Vouchers ([28bb9c3](28bb9c3))
* System was allowing to save payment schedule amount less than grand total (backport [#45322](#45322)) ([#45381](#45381)) ([2403cdc](2403cdc))
* update fields on change of item code In `Update Items` of `Sales Order` ([#45125](#45125)) ([f60a3bc](f60a3bc))
* update voucher outstanding from payment ledger ([e385594](e385594))
* Use `process.extract` to get the corresponding party doc name of the result ([153e961](153e961))
* use frappe.datetime.str_to_user (backport [#45216](#45216)) ([#45417](#45417)) ([6c10393](6c10393))
* use user defined discount amount or default ([e73aab0](e73aab0))
* validate items against selling settings (backport [#45288](#45288)) ([#45431](#45431)) ([7ff7ec7](7ff7ec7))
* validate non-stock item for exchange loss/gain (backport [#45306](#45306)) ([#45380](#45380)) ([4e367de](4e367de))
* valuation for batch (backport [#45335](#45335)) ([#45420](#45420)) ([dec0cae](dec0cae))
* variable names ([8f73978](8f73978))
* Wrong `bank_ac_no` filter + simplify convoluted logic ([60feb7c](60feb7c))

### Features

* Add chart of accounts for Switzerland ([de43c12](de43c12))
* add company level validation for accounting dimension ([8f0d270](8f0d270))
* Add corrective job card operating cost as additional costs in stock entry ([efc7b9a](efc7b9a))
* full screen on pos (backport [#45404](#45404)) ([#45418](#45418)) ([aca8d66](aca8d66))
* pos configuration for print receipt on complete order ([#45392](#45392)) ([b9b4f63](b9b4f63))
* **Sales Invoice:** allow linking to project without adding timesheets (backport [#44295](#44295)) ([#45528](#45528)) ([2c2a25a](2c2a25a))
* **translations:** add Bengali translations for signature and client details ([4952733](4952733))
* **UX:** scroll to required field (backport [#44367](#44367)) ([#45433](#45433)) ([692a448](692a448))

### Performance Improvements

* optimize DB calls with frappe.get_all (backport [#45289](#45289)) ([#45391](#45391)) ([04f5a72](04f5a72))

### Reverts

* Revert "feat(Sales Invoice): allow linking to project without adding timesheets (backport [#44295](#44295))" ([#45531](#45531)) ([b004855](b004855))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants