[IMP] product: Revamp the UoM definition to allow using the intuitive conversion factor + specifying if the UoM is larger/smaller than the reference one. Added a selection field.
bzr revid: uco@tinyerp.co.in-20100315073335-t5888y0tje5jcp7d
This commit is contained in:
@@ -84,7 +84,7 @@ class product_uom(osv.osv):
|
||||
help="Unit of Measure of a category can be converted between each others in the same category."),
|
||||
'factor': fields.float('Rate', digits=(12, 6), required=True,
|
||||
help='The coefficient for the formula:\n' \
|
||||
'1 (base unit) = coeff (this unit). Rate = 1 / Factor.'),
|
||||
'1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'),
|
||||
'factor_inv': fields.function(_factor, digits=(12, 6),
|
||||
method=True, string='Factor',
|
||||
help='The coefficient for the formula:\n' \
|
||||
@@ -93,6 +93,9 @@ class product_uom(osv.osv):
|
||||
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
|
||||
help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."),
|
||||
'uom_factor': fields.selection([('bigger','Bigger than the Default'),
|
||||
('smaller','Smaller than the Default'),
|
||||
('','')],'UoM Factor'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -100,6 +103,7 @@ class product_uom(osv.osv):
|
||||
'factor_inv': lambda *a: 1.0,
|
||||
'active': lambda *a: 1,
|
||||
'rounding': lambda *a: 0.01,
|
||||
'uom_factor': lambda *a: 'smaller',
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
|
||||
@@ -302,9 +302,11 @@
|
||||
<form string="Units of Measure">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="factor" select="1"/>
|
||||
<field name="factor_inv" select="1"/>
|
||||
<field name="factor" select="1" attrs="{'readonly':[('uom_factor','=','bigger')]}"/>
|
||||
<field name="factor_inv_data" select="1" string="Factor Data" attrs="{'readonly':[('uom_factor','=','smaller')]}"/>
|
||||
<field name="factor_inv" invisible="1"/>
|
||||
<field name="rounding"/>
|
||||
<field name="uom_factor"/>
|
||||
<field name="active"/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user