đ Where to find this module?
Main menu > Catalog
Introduction #
Kafinea’s units of measure go beyond a simple list of names: they allow for the management of unit categories, automatic conversions via ratios, custom attributes that can be entered in document lines, and calculated attributes using mathematical formulas. The module is accessible via Catalog > Units of measure.
1. Unit categories #
Each unit of measure belongs to a category (accessible via Catalog > Unit categories). Categories group together units that measure the same quantity.
Example: The “Weight” category groups the units Kilogram, Gram, Ton. The “Length” category groups Meter, Centimeter, Millimeter.
Automatic conversions are only possible between units of the same category.
Tip: Create your categories before creating your units of measure.
2. Create a unit of measure #
Click on Add a unit from the list in the Catalog > Units of measure module.
Information to be provided:
| Field | Description |
|---|---|
| Name | The full name of the unit (required), e.g.: “Kilogram”, “Linear meter” |
| Category | The category to which the unit belongs (required) |
| Ratio | The conversion factor relative to the base unit of the category (required). Can be a number or a mathematical expression using product fields |
| Base unit | Check this box if this unit is the reference for its category (ratio = 1). Only one base unit per category |
Important: Only one unit can be marked as the “Base unit” per category. This is the reference unit for conversions.
The ratio: number or formula #
The ratio can be:
- A fixed number: for example
1000for the Gram if the Kilogram is the base unit (1 kg = 1000 g) - A mathematical expression using product fields: for example, if the “Pallet” unit has a ratio that depends on the number of pieces per pallet defined on the product record
Example: If the base unit is “Piece” (ratio = 1) and a “Box” unit has a ratio of
12, then 1 box = 12 pieces. When entering a document, changing the unit from “Piece” to “Box” will automatically convert the quantity.
3. The three units of a product #
Each product record has a Units of measure block grouping three fields:
| Field | Role |
|---|---|
| Base unit | The product’s reference unit (used by default for stock) |
| Sales unit | The unit automatically proposed in sales documents (quotes, sales orders, sales invoices, delivery notes, credit notes) |
| Purchase unit | The unit automatically proposed in purchase documents (purchase orders, purchase invoices, receipt notes, supplier credit notes) |
Note: When a product is added to a document, Kafinea automatically selects the sales or purchase unit depending on the document type. The user can then change the unit to any other within the same category.
4. Custom attributes #
Attributes are additional fields attached to a unit of measure. They appear in the detail lines of documents and allow the user to enter dimensions or characteristics specific to each line.
To add an attribute, open the record for a unit of measure and use the associated Unit attributes list.
Information to be provided:
| Field | Description |
|---|---|
| Name | The label displayed to the user, e.g.: “Length”, “Width” |
| Internal code | A technical identifier used in formulas and print templates |
| Default value | The value pre-filled when adding a line |
| Visible | Whether the attribute is displayed in document lines |
| Editable | Whether the user can modify the value in document lines |
Example: For a “Square meter” unit, you can create two attributes: “Length” (code
longueur, editable) and “Width” (codelargeur, editable). The user will enter these dimensions in each quote or invoice line.
Note: An attribute that is not visible but present can serve as a variable in calculated attribute formulas.
5. Calculated attributes #
Calculated attributes are values determined automatically by a mathematical formula. They can use as variables:
- The unit’s custom attributes (via their internal code)
- The fields from the product record
To add a calculated attribute, open the record for a unit of measure and use the associated Calculated attributes list.
Information to be provided:
| Field | Description |
|---|---|
| Name | The label displayed, e.g.: “Total area” |
| Internal code | A technical identifier for print templates |
| Expression | The calculation formula, e.g.: longueur * largeur * nb_panneaux |
| Visible | Whether the result is displayed in document lines |
| Display expression | Whether the formula is displayed under the result (for information purposes) |
| Replace quantity | Whether the calculation result should replace the line quantity |
Example: For a “Square meter” unit with “Length”, “Width”, and “Number of panels” attributes, a calculated attribute “Total area” with the expression
longueur * largeur * nb_panneauxwill automatically calculate the area. If “Replace quantity” is checked, the line quantity will be replaced by the calculation result.
Tip: Expressions can reference fields from the product record. For example, if the product has a
poids_unitairefield, you can create a calculated attribute “Total weight” with the expressionpoids_unitaire * nb_colis.
6. Use in documents #
When a product is added to a document line (quote, order, invoice…):
- The unit is selected automatically according to the document type (sales or purchase unit)
- A unit selector allows changing the unit to any other within the same category
- The quantity is converted automatically when changing units thanks to ratios
- Custom attributes appear under the unit selector for entry
- Calculated attributes are automatically recalculated with each modification
Note: Units of measure and their attributes are also available in print templates via dedicated variables.
7. Implementation examples #
Carpentry: sales by square meter #
A carpentry shop sells wood panels whose price depends on the surface area. The operator must be able to enter the length, width, and number of panels directly in the quote, and the surface calculation must serve as the quantity for the line.
Configuration:
- Create the Surface category (via Catalog > Unit categories)
- Create the Square meter unit in this category, with the ratio
1and check Base unit - On the “Square meter” unit record, add three attributes:
| Attribute | Internal code | Visible | Editable | Default value |
|---|---|---|---|---|
| Length | longueur |
â | â | (empty) |
| Width | largeur |
â | â | (empty) |
| Number of panels | nb_panneaux |
â | â | 1 |
- Still on this record, add a calculated attribute:
| Field | Value |
|---|---|
| Name | Total area |
| Internal code | surface |
| Expression | longueur * largeur * nb_panneaux |
| Visible | â |
| Replace quantity | â |
- On the “Wood Panel” product record, fill in the three units with Square meter
Result in a quote:
- The operator adds “Wood Panel” to the quote
- The Length, Width, and Number of panels fields appear in the line
- They enter
Longueur = 2.5,Largeur = 1.2,Nombre de panneaux = 3 - Kafinea automatically calculates: 2.5 Ă 1.2 Ă 3 = 9 mÂČ
- The line quantity is replaced by 9, and the total amount = unit price Ă 9
Note: The “Replace quantity” option is the key to this functionality. Without it, the calculation would be displayed for information purposes but would not modify the line amount.
Store: water bottles in multi-packaging #
A store buys its water bottles in pallets from its supplier, stores them in packs of 6, and sells them either by the pack or by the bottle. The system must automatically convert quantities when changing units.
Configuration:
- Create the Water packaging category (via Catalog > Unit categories)
- Create the following units:
| Unit | Ratio | Base unit |
|---|---|---|
| Bottle | 1 |
â |
| Pack of 6 | 6 |
|
| Pallet (84 packs) | 504 |
- On the “Mineral Water 1.5L” product record:
| Field | Value |
|---|---|
| Base unit | Bottle |
| Sales unit | Pack of 6 |
| Purchase unit | Pallet |
Result at purchase:
- In a purchase order, the operator adds “Mineral Water 1.5L”
- The Pallet unit is automatically selected (purchase document)
- They order 2 pallets
Result at sale:
- In a quote, the Pack of 6 unit is automatically selected (sales document)
- The operator enters 10 packs
- If they change the unit to Bottle via the selector, the quantity is automatically converted: 10 Ă 6 = 60 bottles
- If they then switch to Pallet, the quantity becomes: 60 / 504 â 0.119 pallet
Tip: The unit selector in document lines offers all units from the same category. The sales or purchase unit is only the default selection â the operator can always choose another unit.
Note: The ratio can also be a formula using a product field. For example, if the number of packs per pallet varies by product, create a
packs_par_palettefield on the product record and use the ratiopacks_par_palette * 6for the Pallet unit.
8. Frequently Asked Questions #
How do conversions between units work?
Conversions are automatic between units of the same category, thanks to ratios. For example, if “Kilogram” (ratio 1) is the base unit and “Gram” has a ratio of 1000, switching from 5 kg to Gram will automatically display 5000 g.
Can I use different units for the sale and purchase of the same product?
Yes. Each product has a distinct sales unit and purchase unit. For example, you can buy in “Box of 12” and sell by the “Piece”.
Can I modify a unit of measure already in use?
You can modify the name, ratio, and attributes. Modifying the ratio will affect future conversions but not document lines already saved.
Which units are created by default?
Kafinea comes with the most common units. You can add as many as necessary and create your own categories according to your business.
Glossary #
| Term | Definition |
|---|---|
| Unit category | Grouping of units measuring the same quantity (e.g.: Weight, Length) |
| Base unit | The reference unit of a category, with a ratio of 1 |
| Ratio | The conversion factor between a unit and the base unit of its category |
| Attribute | A custom field attached to a unit, enterable in document lines |
| Calculated attribute | A value calculated automatically by a mathematical formula |