Skip to content

[FW][FIX] stock: add automated way to fix unreserve issue#156063

Closed
fw-bot wants to merge 1 commit intoodoo:saas-16.3from
odoo-dev:saas-16.3-15.0-fix_reservation_action-dafr-w1xp-fw
Closed

[FW][FIX] stock: add automated way to fix unreserve issue#156063
fw-bot wants to merge 1 commit intoodoo:saas-16.3from
odoo-dev:saas-16.3-15.0-fix_reservation_action-dafr-w1xp-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented Mar 1, 2024

When there is a discrepancy of reserved quantity between stock.quant.reserved_quantity and stock.move.line.product_qty the UserError 'It is not possible to unreserve more products of %s than you have in stock' is raised.
This discrepancy can be caused by past bug, customization or direct manipulation of stock.quant or stock.move.line by the users. Once this discrepancy is present, it will not disappear by itself.

Currently, there is no functional method to fix these discrepancies, the user encountering this message is stuck until they contact the Odoo support team.

Ideally, we would fix every bug related to the reservation so that this UserError almost never appears. However, even after multiple bugs fixed (ex: #144176 , #154327 ) and multiple years of feedback, the users keep encountering this error and keep getting stuck when validating/cancelling transfers.

So the idea is to re-introduce a server action like it was done for Odoo 13 & Odoo 14 2 years ago: d99e173 to the current stable version (except the latest one Odoo 17 as we do not have enough perspectives on this version).

The server action checks all the quants and their relative move line to check if match correctly. If not, it will remove the reservation from both. It could remove the reservation from some unrelated pickings and stock.move

Co-authored-by: Arnold Moyaux arm@odoo.com

Forward-Port of #79180
Related to #62139


Demo:

unreserve-2024-02-21_15.54.42.mp4

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #155910
Forward-Port-Of: #154905

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Mar 1, 2024

Pull request status dashboard.

@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Mar 1, 2024

@DavidFesquet cherrypicking of pull request #154905 failed.

stdout:

Auto-merging addons/stock/data/stock_data.xml
CONFLICT (content): Merge conflict in addons/stock/data/stock_data.xml
Auto-merging addons/stock/i18n/stock.pot
Auto-merging addons/stock/models/stock_quant.py
CONFLICT (content): Merge conflict in addons/stock/models/stock_quant.py
Auto-merging addons/stock/tests/test_quant.py

stderr:

13:14:55.404498 git.c:463               trace: built-in: git cherry-pick 3163bed0bb13920972194dc85505083fe2aea250
error: could not apply 3163bed0bb13... [FIX] stock: add automated way to fix unreserve issue
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
----------
status:

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Mar 1, 2024
@C3POdoo C3POdoo added the RD research & development, internal work label Mar 1, 2024
When there is a discrepancy of reserved quantity between `stock.quant.reserved_quantity` and `stock.move.line.product_qty` the UserError 'It is not possible to unreserve more products of %s than you
have in stock' is raised.
This discrepancy can be caused by past bug, customization or direct manipulation of `stock.quant` or `stock.move.line` by the users.
Once this discrepancy is present, it will not disappear by itself.

Currently, there is no functional method to fix these discrepancies, the user encountering this message is stuck until they contact the Odoo support team.

Ideally, we would fix every bug related to the reservation so that this UserError almost never appears.
However, even after multiple bugs fixed (ex: odoo#144176 , odoo#154327 ) and multiple years of feedback, the users keep encountering this error and keep getting stuck when validating/cancelling transfers.

So the idea is to re-introduce a server action like it was done for Odoo 13 & Odoo 14 2 years ago: d99e173 to the current stable version (except the latest one Odoo 17 as we do not have enough perspectives on this version).

The server action checks all the quants and their relative move line to check if match correctly. If not, it will remove the reservation from both.
It could remove the reservation from some unrelated `pickings` and `stock.move`

Forward-Port of odoo#79180
Related to odoo#62139

X-original-commit: e0e63be
Co-authored-by: Arnold Moyaux <arm@odoo.com>
@DavidFesquet DavidFesquet force-pushed the saas-16.3-15.0-fix_reservation_action-dafr-w1xp-fw branch from 7ec13f6 to 18fa1e5 Compare March 4, 2024 08:21
@DavidFesquet
Copy link
Copy Markdown
Contributor

@fw-bot ignore

@DavidFesquet
Copy link
Copy Markdown
Contributor

@robodoo r+

@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Mar 4, 2024

Forward-porting to 'saas-16.3'.

@DavidFesquet
Copy link
Copy Markdown
Contributor

@fw-bot r+

@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Mar 4, 2024

@DavidFesquet I can only do this on unmodified forward-port PRs, ask robodoo.

robodoo pushed a commit that referenced this pull request Mar 4, 2024
When there is a discrepancy of reserved quantity between `stock.quant.reserved_quantity` and `stock.move.line.product_qty` the UserError 'It is not possible to unreserve more products of %s than you
have in stock' is raised.
This discrepancy can be caused by past bug, customization or direct manipulation of `stock.quant` or `stock.move.line` by the users.
Once this discrepancy is present, it will not disappear by itself.

Currently, there is no functional method to fix these discrepancies, the user encountering this message is stuck until they contact the Odoo support team.

Ideally, we would fix every bug related to the reservation so that this UserError almost never appears.
However, even after multiple bugs fixed (ex: #144176 , #154327 ) and multiple years of feedback, the users keep encountering this error and keep getting stuck when validating/cancelling transfers.

So the idea is to re-introduce a server action like it was done for Odoo 13 & Odoo 14 2 years ago: d99e173 to the current stable version (except the latest one Odoo 17 as we do not have enough perspectives on this version).

The server action checks all the quants and their relative move line to check if match correctly. If not, it will remove the reservation from both.
It could remove the reservation from some unrelated `pickings` and `stock.move`

Forward-Port of #79180
Related to #62139

closes #156063

X-original-commit: e0e63be
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
Co-authored-by: Arnold Moyaux <arm@odoo.com>
@robodoo robodoo closed this Mar 4, 2024
@fw-bot fw-bot deleted the saas-16.3-15.0-fix_reservation_action-dafr-w1xp-fw branch March 18, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants