Files
odoo_source/addons/uom
Touati Djamel (otd) ba85494235 [FIX] uom: keep the current factor instead of setting it to 0
Steps to reproduce the bug:
- Create new UOM categories
- Add a new reference UOM
- Add another line, for example:
    - type: “Smaller than the reference”
    - Ratio: 4
- Click outside the line

Problem:
The type is changed to “Bigger” and the ratio is reset to 0,
because we are trying to change the type and the factor based on the value of the current uom factor,
but as this factor has not yet been calculated in `set_ratio` the changes will be distorted.

This part of the code in the onchange is useful when for example we already have a UOM category saved,
and we change the reference, in this case all the UOM will have to be calculated again

Solution:
Don't change the factor and the type in the onchange if it's a new line

opw-2754303

closes odoo/odoo#85214

X-original-commit: daf0dd44345de9877e2e79035d05ddca6c19064b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-02-23 13:58:12 +00:00
..