[16.0][IMP] stock_account_product_run_fifo_hook: add hooks that allows to change unit cost layer precision #1776
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set precision Product Price 4 digits and change unit_cost field in layers to that precision (that is standard Odoo change in v17)
This is causing many rounding issues when using higher Product Price precision.
Example 1:
Product price 8.2833 and qty 10
Remove one unit: it is removed @ 8.2833 unit_cost --> it is removed @ 8.2800 Add oen unit back: it is added @ 8.2833 unit_cost
If you do this many times you are adding value incorrectly
Example 2:
Product Price 10.0033 and qty 10
Change product price to 8.2833
The system is not adding any value to your valuation
Change product price to 8.2844
The system is adding 0.01 to your valuation
In my opinion when you use the unit cost like this: https://github.com/odoo/odoo/blob/16.0/addons/stock_account/models/product.py#L354
when the reamining value is rounded already to 2, you are creating rounding issues in your valuation. It makes no sense to have separate unit of measure when you are using this value in the calculation
Ok, value makes sense to be Monetary, but then do use the full number in the calculation otherwise it will generate many unit cost rounding issues.
Ok, if I dont change the precision of the unit cost in the layer (remmeber standard cahnge in v17) this issue is not happening as the unit cost is already rounded and the rounding issues are less than 0.01. However, the hooks make sense, don't they?
Ok, you won't merge this, but at least let me argue a bit.