2010-04-02 14:43:27 |
Blqt |
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 (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">
<field name="name">test.float.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="volume" position="replace">
<field name="volume" on_change="onchange_volume(volume,weight)"/>
</field>
</field>
</record>
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
def onchange_volume(self, cr, uid, ids,volume,weight):
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 |
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">
<field name="name">test.float.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="volume" position="replace">
<field name="volume" on_change="onchange_volume(volume,weight)"/>
</field>
</field>
</record>
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
def onchange_volume(self, cr, uid, ids,volume,weight):
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
|
|
2010-04-03 08:15:06 |
Blqt |
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 (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">
<field name="name">test.float.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="volume" position="replace">
<field name="volume" on_change="onchange_volume(volume,weight)"/>
</field>
</field>
</record>
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
def onchange_volume(self, cr, uid, ids,volume,weight):
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
|
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_float_form_view" model="ir.ui.view">
<field name="name">test.float.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="volume" position="replace">
<field name="volume" on_change="onchange_volume(volume,weight)"/>
</field>
</field>
</record>
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
def onchange_volume(self, cr, uid, ids,volume,weight):
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
|
|