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

fix: Advance paid amount in orders #32642

Merged

Conversation

deepeshgarg007
Copy link
Member

When two partial payment entries are made simultaneously against a single order using two separate requests, both requests try to update the Advance Paid amount simultaneously and create a race condition.

Since both the requests read the previous advance amount as 0 the amount of the request which updates the value later is only seen rather than the sum of both entries.

Added a for_update flag to resolve the issue

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Oct 19, 2022
@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Merging #32642 (0567d2e) into develop (633c2a2) will decrease coverage by 0.27%.
The diff coverage is 88.23%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #32642      +/-   ##
===========================================
- Coverage    63.99%   63.72%   -0.28%     
===========================================
  Files          817      816       -1     
  Lines        58228    58310      +82     
===========================================
- Hits         37264    37156     -108     
- Misses       20964    21154     +190     
Impacted Files Coverage Δ
erpnext/regional/united_arab_emirates/setup.py 100.00% <ø> (ø)
...ctype/stock_reconciliation/stock_reconciliation.py 83.51% <0.00%> (ø)
erpnext/utilities/doctype/video/video.py 22.22% <0.00%> (ø)
erpnext/controllers/stock_controller.py 92.12% <81.81%> (-0.26%) ⬇️
...xt/accounts/doctype/payment_entry/payment_entry.py 72.79% <100.00%> (ø)
...ounts/doctype/purchase_invoice/purchase_invoice.py 83.83% <100.00%> (+0.07%) ⬆️
erpnext/controllers/selling_controller.py 79.56% <100.00%> (ø)
erpnext/stock/doctype/item/item.py 85.45% <100.00%> (ø)
erpnext/stock/stock_ledger.py 90.27% <100.00%> (+0.10%) ⬆️
...unts/report/purchase_register/purchase_register.py 34.21% <0.00%> (-37.51%) ⬇️
... and 46 more

@ankush ankush removed the needs-tests This PR needs automated unit-tests. label Oct 19, 2022
@ankush ankush merged commit 4304921 into frappe:develop Oct 19, 2022
mergify bot pushed a commit that referenced this pull request Oct 19, 2022
mergify bot pushed a commit that referenced this pull request Oct 19, 2022
(cherry picked from commit 4304921)

# Conflicts:
#	erpnext/accounts/doctype/payment_entry/payment_entry.py
ankush pushed a commit that referenced this pull request Oct 19, 2022
fix: Advance paid amount in orders (#32642)

(cherry picked from commit 4304921)

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Oct 26, 2022
# [14.4.0](v14.3.1...v14.4.0) (2022-10-26)

### Bug Fixes

* Advance paid amount in orders (backport [#32642](#32642)) ([#32648](#32648)) ([8a88105](8a88105))
* allow to create Sales Order from expired Quotation ([#32641](#32641)) ([ccc58f4](ccc58f4))
* Billing Address for inter-company purchase docs ([f8934fa](f8934fa))
* BOM cost update message ([e539579](e539579))
* dont update item info twice ([8876904](8876904))
* incorrect qty in material request ([da538a3](da538a3))
* number of months subscription plan ([fff9e76](fff9e76))
* overlap error not raised for job card in case of workstation with production capacity ([ed2a093](ed2a093))
* party type and party mandatory on updating outstanding ([9a5e238](9a5e238))
* searchfield not working for cuctsomer, supplier as per customize form ([fb1c307](fb1c307))
* unset contact details ([d7a65b1](d7a65b1))

### Features

* Basic Payment Ledger report ([5cb9f7b](5cb9f7b))
* Repayment schedule types for term loans ([6ce32fd](6ce32fd))

### Performance Improvements

* cache barcode scan result (backport [#32629](#32629)) ([#32672](#32672)) ([3300856](3300856))
@barredterra barredterra mentioned this pull request Mar 7, 2023
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.

None yet

2 participants