Skip to content

[FW][FIX] product: Warning when setting a UOM more precise than Decimal A…#58126

Closed
fw-bot wants to merge 1 commit intoodoo:saas-11.3from
odoo-dev:saas-11.3-11.0-stock-product_uom-unreserve-fah-Yc2T-fw
Closed

[FW][FIX] product: Warning when setting a UOM more precise than Decimal A…#58126
fw-bot wants to merge 1 commit intoodoo:saas-11.3from
odoo-dev:saas-11.3-11.0-stock-product_uom-unreserve-fah-Yc2T-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented Sep 21, 2020

…ccuracy

One can set a Unit of Measure precision rounding more
precise than the overall Decimal Accuracy. This can trigger the error
'It is not possible to unreserve more products', as there will be
inconsistencies on reserved quantities due to decimal roundings.
We add a warning, so that the users who make the change are aware of the
impact of modifying their UOM precision.

opw 2171541
opw 2221227
opw 2233937
opw 2198775
and many more

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

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

Forward-Port-Of: #54935

@robodoo robodoo added conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot seen 🙂 labels Sep 21, 2020
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Sep 21, 2020

Ping @fah-odoo, @amoyaux
Cherrypicking 97430bb of source #54935 failed

stderr:

error: could not apply 97430bba609... [FIX] product, decimal_precision, stock, mrp: Prevent quant reservation issue
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

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.

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Sep 21, 2020
…on issue

One can set a Unit of Measure precision rounding more
precise than the overall Decimal Accuracy. This can trigger the error
'It is not possible to unreserve more products', as there will be
inconsistencies on reserved quantities due to decimal roundings.
We add 2 warnings on Units of Measure and Decimal Accuracy.
Therefore, users are warned when their UOM/decimal changes can
cause inconsistencies in quants reservation.

Also, we want to prevent the issue at the root by ensuring that both the move
and the quant have the same reserved quantity.
The contrary can happen e.g. when a product is defined in Liters (rounding .001)
but used in an operation in ml (rounding .01, so e.g. 187.5ml).
The conversions between the 2 UOM can cause the differences of reservations.

In _prepare_move_line_vals we make sure uom_quantity_back_to_product_uom
is not more precise than the overall Decimal Accuracy. That way, if
the reserved quantity changes between UOM conversions, the move line created
is in the quant/product UOM, and we do not have move line's reserved quantity >
quantity in stock.
We do the same for _update_reserved_quantity (stock.move), when updating
a move line.

In _generate_consumed_move_line, because of UOM conversions, new_quantity_done
can differ from ml.product_uom_qty, which triggers the creation of an extra
move line, leading to reserved quantity > quantity in stock. To prevent
that, we compare the reserved quantities in the product UOM.

opw 2206902 (Example 1)
opw 2171541
opw 2221227
opw 2233937
opw 2198775
and many more

X-original-commit: 39c0c7e
@fah-mili fah-mili force-pushed the saas-11.3-11.0-stock-product_uom-unreserve-fah-Yc2T-fw branch from 1518a7f to 5535110 Compare September 21, 2020 14:20
@robodoo robodoo added ☐ legal/cla CI 🤖 Robodoo has seen passing statuses and removed ☑ legal/cla labels Sep 21, 2020
@fah-mili
Copy link
Copy Markdown

@amoyaux working on resolving the conflicts, hope I didn't forget anything (all the product.uom should be replaced with uom.uom).

@amoyaux
Copy link
Copy Markdown
Contributor

amoyaux commented Sep 22, 2020

robodoo r+

robodoo pushed a commit that referenced this pull request Sep 22, 2020
…on issue

One can set a Unit of Measure precision rounding more
precise than the overall Decimal Accuracy. This can trigger the error
'It is not possible to unreserve more products', as there will be
inconsistencies on reserved quantities due to decimal roundings.
We add 2 warnings on Units of Measure and Decimal Accuracy.
Therefore, users are warned when their UOM/decimal changes can
cause inconsistencies in quants reservation.

Also, we want to prevent the issue at the root by ensuring that both the move
and the quant have the same reserved quantity.
The contrary can happen e.g. when a product is defined in Liters (rounding .001)
but used in an operation in ml (rounding .01, so e.g. 187.5ml).
The conversions between the 2 UOM can cause the differences of reservations.

In _prepare_move_line_vals we make sure uom_quantity_back_to_product_uom
is not more precise than the overall Decimal Accuracy. That way, if
the reserved quantity changes between UOM conversions, the move line created
is in the quant/product UOM, and we do not have move line's reserved quantity >
quantity in stock.
We do the same for _update_reserved_quantity (stock.move), when updating
a move line.

In _generate_consumed_move_line, because of UOM conversions, new_quantity_done
can differ from ml.product_uom_qty, which triggers the creation of an extra
move line, leading to reserved quantity > quantity in stock. To prevent
that, we compare the reserved quantities in the product UOM.

opw 2206902 (Example 1)
opw 2171541
opw 2221227
opw 2233937
opw 2198775
and many more

closes #58126

X-original-commit: 39c0c7e
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
@robodoo robodoo closed this Sep 22, 2020
@robodoo robodoo temporarily deployed to merge September 22, 2020 08:20 Inactive
@fw-bot fw-bot deleted the saas-11.3-11.0-stock-product_uom-unreserve-fah-Yc2T-fw branch October 6, 2020 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI 🤖 Robodoo has seen passing statuses conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants