In order to restrict some uom field to some uom category, it is required to add a measurement type on uom.category. Also, this will lessen the use of master data. Some technical justifications: - measure_type is not required, to allow people creating their own uom.category. Those ones will not interfere with addons business. - measure_type is unique: we restrict to only one category containing time, weight, ... in order to avoid mismatch category during conversion. (2 different weight categories can not be converted). - measure_type on uom.uom is stored: to allow search and domain on field, we need to store it. Usually, UoM are not updated every day, and the number of uom in a database is not that important. To illustrate this mecanism, a domain is added on 'project_time_mode_id', in project module. This field is use as timesheet default uom, and we obviously want to restrict it to time category (timesheeting in liter does not make sense ...) Task #1820076
93 lines
3.9 KiB
XML
93 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<record id="product_uom_tree_view" model="ir.ui.view">
|
|
<field name="name">uom.uom.tree</field>
|
|
<field name="model">uom.uom</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="Units of Measure">
|
|
<field name="name"/>
|
|
<field name="category_id"/>
|
|
<field name="uom_type"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="product_uom_form_view" model="ir.ui.view">
|
|
<field name="name">uom.uom.form</field>
|
|
<field name="model">uom.uom</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Units of Measure">
|
|
<group>
|
|
<group>
|
|
<field name="name"/>
|
|
<field name="category_id"/>
|
|
<field name="uom_type"/>
|
|
<field name="factor"
|
|
digits="[42,5]"
|
|
attrs="{'invisible':[('uom_type','!=','smaller')],
|
|
'readonly':[('uom_type','=','bigger')]}"/>
|
|
<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" colspan="2">
|
|
e.g: 1 * (reference unit) = ratio * (this unit)
|
|
</p>
|
|
<p attrs="{'invisible':[('uom_type','!=','bigger')]}" class="oe_grey" colspan="2">
|
|
e.g: 1 * (this unit) = ratio * (reference unit)
|
|
</p>
|
|
</group>
|
|
<group>
|
|
<field name="active"/>
|
|
<field name="rounding" digits="[42, 5]"/>
|
|
</group>
|
|
</group>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
<record id="product_uom_form_action" model="ir.actions.act_window">
|
|
<field name="name">Units of Measure</field>
|
|
<field name="type">ir.actions.act_window</field>
|
|
<field name="res_model">uom.uom</field>
|
|
<field name="view_type">form</field>
|
|
<field name="view_id" ref="product_uom_tree_view"/>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
Add a new unit of measure
|
|
</p><p>
|
|
You must define a conversion rate between several Units of
|
|
Measure within the same category.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="product_uom_categ_form_view" model="ir.ui.view">
|
|
<field name="name">uom.category.form</field>
|
|
<field name="model">uom.category</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Units of Measure categories">
|
|
<group>
|
|
<field name="name"/>
|
|
<field name="measure_type"/>
|
|
</group>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
<record id="product_uom_categ_form_action" model="ir.actions.act_window">
|
|
<field name="name">Unit of Measure Categories</field>
|
|
<field name="type">ir.actions.act_window</field>
|
|
<field name="res_model">uom.category</field>
|
|
<field name="view_type">form</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
Add a new unit of measure category
|
|
</p><p>
|
|
Units of measure belonging to the same category can be
|
|
converted between each others. For example, in the category
|
|
<i>'Time'</i>, you will have the following units of measure:
|
|
Hours, Days.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
</odoo> |