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: Stock Ageing Report - Negative Opening Stock #28966

Merged
merged 9 commits into from
Dec 28, 2021

Conversation

marination
Copy link
Collaborator

@marination marination commented Dec 20, 2021

Issue:
Consider ledger:

  1. -30, 1st Dec
  2. 100, 2nd Dec
  3. -10, 3rd Dec
  • Stock Ageing Report ignored the first entry (no impact) as there is no existing qty in the FIFO Queue to consume from
  • Hence, the total qty of the range columns here would show 30 qty more than the actual value [100 -10 (90) instead of -30+100-10 (60)]

Fix:

  • Added a case to handle empty FIFO Queue. It could be empty because it was all consumed or because there was never any incoming stock
  • Either way, add the negative qty to the queue
  • When stock is added (+ve) add it to the negative balance to neutralise it until the balance is positive.
  • Code cleanup: new class for FIFOSlots to generate chronological FIFO queue
    Usage
      FIFOSlots(filters).generate()
    Screenshot 2021-12-27 at 9 08 15 PM

Dependencies/To Test:

  • Stock Ageing Report end-to-end with various ledger scenarios (can pick up some from the .md file in this PR)
  • Report warehouse wise item balance age and value
  • Report stock balance with show ageing data checked

- Consider negative opening stock in logic and neutralise it with +ve stock
- minor code refactor: class for FIFOSlots to generate chronological FIFO queue
- args passed to wrong function
- missing space around '='
@marination marination added this to the v13.18 milestone Dec 22, 2021
@codecov
Copy link

codecov bot commented Dec 27, 2021

Codecov Report

Merging #28966 (09f26d8) into develop (21b0738) will increase coverage by 10.59%.
The diff coverage is 95.65%.

@@             Coverage Diff              @@
##           develop   #28966       +/-   ##
============================================
+ Coverage    44.95%   55.54%   +10.59%     
============================================
  Files         1128     1128               
  Lines        67295    67331       +36     
============================================
+ Hits         30251    37400     +7149     
+ Misses       37044    29931     -7113     
Impacted Files Coverage Δ
...rpnext/stock/report/stock_balance/stock_balance.py 79.16% <50.00%> (+67.85%) ⬆️
erpnext/stock/report/stock_ageing/stock_ageing.py 93.06% <96.39%> (+81.38%) ⬆️
...value/warehouse_wise_item_balance_age_and_value.py 92.40% <100.00%> (+92.40%) ⬆️
...production_plan_summary/production_plan_summary.py 0.00% <0.00%> (-79.49%) ⬇️
...work_order_stock_report/work_order_stock_report.py 50.00% <0.00%> (-47.06%) ⬇️
erpnext/utilities/product.py 14.70% <0.00%> (-35.30%) ⬇️
erpnext/shopping_cart/product_info.py 30.30% <0.00%> (-21.22%) ⬇️
.../manufacturing/report/bom_explorer/bom_explorer.py 94.44% <0.00%> (-5.56%) ⬇️
...e/shopping_cart_settings/shopping_cart_settings.py 65.38% <0.00%> (-1.93%) ⬇️
erpnext/shopping_cart/product_query.py 61.19% <0.00%> (-1.50%) ⬇️
... and 258 more

@marination marination marked this pull request as ready for review December 27, 2021 19:59
@marination
Copy link
Collaborator Author

Sider failing on .md file, remark-lint was disabled for this repo, idk why its still failing

@marination
Copy link
Collaborator Author

@Mergifyio backport version-13-hotfix

@mergify
Copy link
Contributor

mergify bot commented Dec 28, 2021

backport version-13-hotfix

🟠 Waiting for conditions to match

  • merged [:pushpin: backport requirement]

@mergify
Copy link
Contributor

mergify bot commented Dec 28, 2021

backport version-13-hotfix

✅ Backports have been created

marination added a commit that referenced this pull request Dec 28, 2021
…-28966

fix: Stock Ageing Report - Negative Opening Stock (backport #28966)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant