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: incorrect amount of serial_nos fetched #28051

Merged
merged 6 commits into from
Oct 29, 2021

Conversation

noahjacob
Copy link
Contributor

@noahjacob noahjacob commented Oct 21, 2021

Issue

  • While creating a stock reconciliation, serial nos. that get fetched are "Delivered" serial nos.
  • Since "Delivered" serial nos. don't have warehouse set it would throw the following error and not let the user make the entry since this is been auto-fetched by default.

image

Reason

  • The condition only checks if the serial nos mentioned in the last stock ledger entry is < the qty_after transaction. If it is, it would fetch the rest of the serial nos.

image

  • This check fails in a case where the serial numbers in the last stock entry is equal to the qty_after_transaction. For eg. if the current stock entry is 14 and I try to create a Sales Invoice with qty 7, the stock ledger entry would look like this.

image

  • For the above sle, the check would fail and the delivered serial nos would get fetched from this sle.

Fixes

  • Updated the condition to include the edge case i.e replaced '<' with '<='.
  • Also updated query that is used while fetching the rest of the serial nos. "Is_cancelled" SLEs were also considered while fetching the serial_nos which would sometimes add/remove the wrong serial nos from the list. This would sometimes lead to the below error.

image

Steps to reproduce

  • Create a Sales Invoice against an item with the half the amount of it's current qty. Eg. If Qty at the warehouse for the item = 14, set the amount to 14/2 = 7 in the sales invoice. (Make sure the item has serial nos.)
  • Try creating a Stock Reconciliation against the item.

@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #28051 (f7a6a8d) into develop (d0e2b52) will decrease coverage by 0.07%.
The diff coverage is 91.66%.

@@             Coverage Diff             @@
##           develop   #28051      +/-   ##
===========================================
- Coverage    55.42%   55.35%   -0.08%     
===========================================
  Files         1248     1248              
  Lines        67692    67698       +6     
===========================================
- Hits         37521    37473      -48     
- Misses       30171    30225      +54     
Impacted Files Coverage Δ
erpnext/stock/utils.py 67.63% <91.66%> (+3.34%) ⬆️
erpnext/utilities/product.py 15.94% <0.00%> (-34.79%) ⬇️
...wise_balance_history/batch_wise_balance_history.py 69.49% <0.00%> (-23.73%) ⬇️
erpnext/shopping_cart/product_info.py 32.35% <0.00%> (-20.59%) ⬇️
...payroll/doctype/income_tax_slab/income_tax_slab.py 85.71% <0.00%> (-14.29%) ⬇️
...eport/item_variant_details/item_variant_details.py 84.52% <0.00%> (-3.58%) ⬇️
erpnext/education/doctype/student/student.py 73.95% <0.00%> (-3.13%) ⬇️
erpnext/stock/report/stock_ageing/stock_ageing.py 90.64% <0.00%> (-2.88%) ⬇️
...value/warehouse_wise_item_balance_age_and_value.py 92.59% <0.00%> (-2.47%) ⬇️
...ion/doctype/course_enrollment/course_enrollment.py 45.09% <0.00%> (-1.97%) ⬇️
... and 20 more

@ankush ankush self-assigned this Oct 29, 2021
ankush
ankush previously approved these changes Oct 29, 2021
@ankush ankush dismissed their stale review October 29, 2021 10:25

SR case in sr no computation

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