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: unnecessary GLE reposts #31240

Merged
merged 2 commits into from
Jun 10, 2022
Merged

fix: unnecessary GLE reposts #31240

merged 2 commits into from
Jun 10, 2022

Conversation

ankush
Copy link
Member

@ankush ankush commented Jun 6, 2022

In Sales/Purchase invoices credit/debit are flipped and negated while making GLE,
this is unflipped while posting them but if we compare the flipped ones
it will always result in comparison failure and repost it.

@github-actions github-actions bot added accounts needs-tests This PR needs automated unit-tests. labels Jun 6, 2022
@codecov
Copy link

codecov bot commented Jun 6, 2022

Codecov Report

Merging #31240 (eb53a97) into develop (5c69378) will decrease coverage by 0.17%.
The diff coverage is 74.07%.

@@             Coverage Diff             @@
##           develop   #31240      +/-   ##
===========================================
- Coverage    63.50%   63.33%   -0.18%     
===========================================
  Files          986      986              
  Lines        67457    67460       +3     
===========================================
- Hits         42838    42725     -113     
- Misses       24619    24735     +116     
Impacted Files Coverage Δ
...t/accounts/report/sales_register/sales_register.py 73.68% <ø> (-8.19%) ⬇️
erpnext/e_commerce/redisearch_utils.py 36.42% <ø> (ø)
erpnext/loan_management/doctype/loan/loan.py 67.78% <44.44%> (ø)
...ext/stock/doctype/stock_entry/stock_entry_utils.py 93.33% <66.66%> (ø)
...ounts/doctype/purchase_invoice/purchase_invoice.py 83.48% <100.00%> (ø)
erpnext/accounts/utils.py 69.79% <100.00%> (-0.02%) ⬇️
erpnext/controllers/sales_and_purchase_return.py 91.41% <100.00%> (-0.75%) ⬇️
erpnext/regional/india/e_invoice/utils.py 38.53% <100.00%> (ø)
...unts/report/purchase_register/purchase_register.py 34.21% <0.00%> (-42.77%) ⬇️
...tch_item_expiry_status/batch_item_expiry_status.py 67.92% <0.00%> (-24.53%) ⬇️
... and 38 more

In Sales/Purchase invoices credit/debit are flipped and negated while making GLE,
this is unflipped while posting them but if we compare the flipped ones
it will always result in comparison failure and repost it.
If you have a huge list of docs to repost then maintaining transaction
throughtout entire GL reposting is not only unnecessary but also creates
performance issues. Periodically commiting the changes prevents lost
progress and reduces memory usage.
@ankush ankush removed accounts needs-tests This PR needs automated unit-tests. labels Jun 9, 2022
@ankush ankush marked this pull request as ready for review June 9, 2022 06:08
@ankush ankush requested review from marination and rohitwaghchaure and removed request for nextchamp-saqib and deepeshgarg007 June 9, 2022 06:08
@ankush ankush merged commit 450bef8 into frappe:develop Jun 10, 2022
ankush added a commit to ankush/erpnext that referenced this pull request Jun 15, 2022
ankush added a commit to ankush/erpnext that referenced this pull request Jun 15, 2022
ankush added a commit that referenced this pull request Jun 15, 2022
)

* fix: dont use cached doc for GLE reposts

ported from #31240

* perf: GLE reposting with progress and chunking

If stock voucher count goes >1000 then fetching all gles and reposting
them all at once requires much more memory and can cause crash.

- This PR ensures that GLE reposting is done in chunks of 100 vouchers.
- This PR also starts keeping track of how many such chunks were
  processed so in future progress is resumed in event of timeout.

* test: add "actual" test for chunked GLE reposting
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

1 participant