How to showing how to specify the magnitude of an attribute of a resource (like the weight of a product).
Table of Contents
A measure allows to specify the magnitude (quantity * quantity_unit) of some
attribute (metric_type¶) of a resource (ex: Product, Service...), such as its
length or mass. Thus, an amount of a resource can be expressed according to any
of its metric types. For example, the weight of a product is 5kg.
A measure is defined on a resource and is roughly a triplet (metric_type¶,
A measure describes a resource in respect to 1 management unit of the resource.
The quantity_unit¶ base category is a database of measurement units.
It is filled independently from any resource. Units used for a given physical
quantity are grouped in the same subcategory, so we have the following schema:
Each unit has a quantity property containing the ratio in respect to a base
unit (of the same physical quantity). The ratio must be 1 for a base one. /!\
Since r31858 the usage of quantity property is deprecated. Please see the Setting
up Quantity Unit Conversion Module section below.
metric_type¶ is a base category defining any attribute a resource might have.
The schema must be similar to quantity_unit so that it is possible to determine
relevant units for each metric type:
Go to the Unit Conversions module. Here, you will define a base quantity for each
quantity_unit¶/<physical_quantity> category and define the ratios between
quantities of that category.
Example¶ to set up kilgrams and grams:
If you were to define the mass/ton unit, you would use the same Quantity Unit
Conversion Group. If the physical unit is different (e.g. volume/liter),
you would create a new Group.
A measure object must be added to a resource for any metric type you want to describe.
To add a measure:
Variations are supported: When the resource is variated, you can choose according
to which base category the measure is variated. From the Measure tab of a
resource, you can see the measures in a listbox. You can also edit them directly.
Only specifying 'quantity * quantity_unit' is not enough to represent an amount
of resource. In principle, a metric type should also be given, because a resource
may have several metric types using the same physical quantity.
'quantity * quantity_unit'
For example, the gram could represent either the "gross weight" or the "net weight"
of a resource. Since there are places in ERP5 where you can only choose a quantity
unit, there is a way to associate a default measure to each physical quantity,
thanks to the Default Metric Type setting of a measure.
The first quantity unit of a resource is its management unit. On cataloging, an
implicit measure is created for the management unit, in case there isn't any.
The metric type used for such a measure is a generic one, i.e. metric_type¶/<physical_quantity>
If you want to manage a resource according to a specific metric type, you must
create a measure for the management unit, with the following restriction:
Note:The validation of a resource will check that all measures
and units are consistent. However, constraints on resources are disabled by
default: you must add the ResourceContraint property sheet on portal types
for which you want checking to be done.
From a resource module page, a Converted Inventory Report is available:
Only metric types common to all selected resources can be chosen.
Let's given a box of 12 eggs, knowing that there are several sizes of eggs:
Create the following measure for the net weight:
Do the same for the gross weight:
For the number of eggs per box:
Set the following quantity units to the resource:
When buying boxes of eggs, you can specify the quantity of boxes in:
You can also know the number of eggs in all nodes: