[FIX] product: Warning when setting a UOM more precise than Decimal A…#54935
[FIX] product: Warning when setting a UOM more precise than Decimal A…#54935
Conversation
9fe7443 to
ed2165b
Compare
ed2165b to
d125ef3
Compare
|
Globally, I'm not sure that a warning is enough. Maybe we should block the flow at https://github.com/odoo/odoo/blob/11.0/addons/stock/models/stock_move.py#L886 and ensure that the quantity in the move uom is similar to the quantity reserved on the quant |
Indeed, it's a first attempt to contain the damages.
Ok if it has no huge perf impact |
d125ef3 to
217218c
Compare
|
I dont think it's the proper fix, we'll discuss. Also does the warning allow you to proceed if you really want to proceed ? |
|
Ok, thanks for checking it out. |
217218c to
c245049
Compare
|
robodoo r+ |
…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 #54935 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58173 |
4 similar comments
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58173 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58173 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58173 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58173 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58762 |
2 similar comments
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58762 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58762 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #58762 |
|
This pull request has forward-port PRs awaiting action (not merged or closed): #59718 |
…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 odoo#54935 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
…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