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 (windows).
On linux, I have not been able to understand how it is rounded.
Example (this example is simple and stupid, but this error prevents us from using web client for sale and purchase order with price_accuracy=3)
That example divides weight by 3 when volume is changed on a product form
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 !!!
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 (windows).
On linux, I have not been able to understand how it is rounded.
Example (this example is simple and stupid, but this error prevents us from using web client for sale and purchase order with price_accuracy=3)
That example divides weight by 3 when volume is changed on a product form
<record id="test_ float_form_ view" model="ir.ui.view"> >test.float. form</field> >product. product< /field> product_ normal_ form_view" /> >form</ field>
< field name="volume" position="replace">
< field name="volume" on_change= "onchange_ volume( volume, weight) "/>
< /field>
</ field>
<field name="name"
<field name="model"
<field name="inherit_id" ref="product.
<field name="type"
<field name="arch" type="xml">
</record>
class product_ product( osv.osv) : volume( self, cr, uid, ids,volume,weight):
_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 !!!
/Benoit