[FIX] product.uom: safer handling of factor/factor_inv in UI
authorMartin Trigaux <mat@openerp.com>
Thu, 9 Oct 2014 11:37:06 +0000 (13:37 +0200)
committerOlivier Dony <odo@openerp.com>
Wed, 22 Oct 2014 12:28:35 +0000 (14:28 +0200)
Add readonly attribute to avoid sending both factor and factor_inv value to the backend when saving.
This was possible if the user switched between uom_type to fill the two fields.

addons/product/product_view.xml

index 7b4539e..a59a77c 100644 (file)
                             <field name="uom_type" on_change="onchange_type(uom_type)"/>
                             <label for="factor"/>
                             <div>
-                                <field name="factor" digits="[42,5]" attrs="{'invisible':[('uom_type','!=','smaller')]}"/>
-                                <field name="factor_inv" digits="[42,5]" attrs="{'invisible':[('uom_type','!=','bigger')]}"/>
+                                <field name="factor"
+                                    digits="[42,5]"
+                                    attrs="{'invisible':[('uom_type','!=','smaller')],
+                                            'readonly':[('uom_type','!=','smaller')]}"/>
+                                <field name="factor_inv"
+                                    digits="[42,5]"
+                                    attrs="{'invisible':[('uom_type','!=','bigger')],
+                                            'readonly':[('uom_type','!=','bigger')]}"/>
                                 <p attrs="{'invisible':[('uom_type','!=','smaller')]}" class="oe_grey">
                                     e.g: 1 * (reference unit) = ratio * (this unit)
                                 </p>