Incorrect behavior of on_change for floats on web client
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Web Client |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
There is a different behavior for on_change between web client and gtk (gtk works fine):
Environment : 5.07 Windows AND linux
When on_change modifies a float field in a form, the field is rounded with 2 decimals using the web client .
On linux, the rounding is different, but false too.
Example:
This example divides weight by 3 when volume is changed on a product form
This example is simple and stupid, but this error prevents us from using web client for sale and purchase order with price_accuracy=3 (product_id_change returns price rounded with 2 digits)
<record id="test_
<field name="name"
<field name="model"
<field name="inherit_id" ref="product.
<field name="type"
<field name="arch" type="xml">
</record>
class product_
_name = 'product.product'
_inherit = 'product.product'
def onchange_
v = {}
v['weight'] = weight/3
return {'value': v}
product_product()
1) Create or edit a product
2) Enter weight = 1.000
3) Enter volume= whatever you want
4) on window weight becomes 0.33 where it should be 0.333. On linux, weight becomes 0 !!!
with gtk, everything is fine and weight is changed to 0.333
/Benoit
I have found a workaround by changing
class Float(Number):
if_empty = False
digit = 2
...
to
class Float(Number):
if_empty = False
digit = 5
...
in web/python/ Lib/site- packages/ openero_ web.../ openerp/ validators/ validators. py
Is it the right thing to do?
Benoit