Module Units of Measure


DolibarrUserAustralia-UnitsOfMeasure-logo.png
Editor Dolibarr User Australia
Module ID 491732
Version 1.0.0
Dolibarr 23, 24
Where to get it DoliStore (Units of Measure, free)
Support dolibarruseraustralia@gmail.com
Licence GPL v3 or later

Dolibarr counts every product in a single unit. When you buy by the carton and sell by the bottle, the carton or the pallet, the packs end up in product labels, with multiplications done by hand and rounded totals. Units of Measure lets you buy and sell a product in several units while stock, cost price and accounting stay in one base unit.

Example: a 5 litre bottle is stocked as Bottle 5Lt. The supplier sells it by the carton of 3; you sell it by the bottle, the carton and the pallet of 36 cartons. A purchase order line "2 × Carton at 39.00" receives 6 bottles into stock; a quote line "1 × Pallet at 1,350.00" is 108 bottles. Line totals and tax are exactly 2 × 39.00 and 1 × 1,350.00.

What it does

  • Base units: the single item you stock, e.g. Each, Bottle 5Lt, Drum 20Lt, Can 156g.
  • Unit sets (Products → Unit sets): packs holding a quantity of a base unit or of another set, so bigger packs build on smaller ones: Carton = 3 × Bottle 5Lt, Pallet = 36 × Carton (= 108 bottles). Products packed the same way share the same sets.
  • Units tab on products: the base unit, the biggest pack the product is bought or sold in, a selling price per unit (pre-filled as base price × the number of base units, editable), the default unit for sales, and the best vendor price per unit.
  • Vendor prices: "Vendor sells by" a pack. The price is entered per pack; Dolibarr's minimum purchase quantity and Packaging are set to the pack size, so Dolibarr keeps comparing vendors per base unit.
  • A Unit drop-down on document lines: quotes, sales orders, invoices, purchase orders and supplier invoices, when adding a line and when editing it. The unit's price is filled in; changing the unit of an existing line converts its quantity and price so the total stays the same.
  • Exact totals: Dolibarr stores the line in base units (6 bottles at 13.00), so stock movements, cost prices, margins and accounting work as usual; the line total and tax are exactly pack quantity × pack price.
  • Units follow the documents: quote → order → invoice, shipment → invoice, purchase order or reception → supplier invoice.
  • Shipments and receptions are entered in base units; the unit each line was ordered in is shown beside the quantity, and on the shipment or reception.
  • Purchase orders: a quantity typed in bottles for a vendor who sells by the carton is rounded up to whole cartons, with a message.
  • No changes to Dolibarr files: hooks and triggers only.

Documents

  • PDF: lines show the quantity and price in the unit entered. Column templates (cyan, eratosthene, espadon...) get a Unit column; older templates show "Unit: ..." in the description. Shipment and reception PDFs show packs when the quantities are whole packs, with weights and volumes still right.
  • ODT: {line_qty}, {line_up} and {line_unit} are in the unit entered. Extra keys: {line_uom_unit} (e.g. CTN 3 x 5Lt), {line_uom_unit_full} (CTN 3 x 5Lt (3 × Bottle 5Lt)), {line_uom_base_qty} (6), {line_uom_base_unit} (Bottle 5Lt).

Installation

Home → Setup → Modules/Applications → "Deploy/install external app/module", upload the zip, then enable "Units of Measure" (Products). Then add your base units (gear icon), your packs in Products → Unit sets, and choose them on each product's Units tab.

Dolibarr's supplier Packaging option

Setup → Modules → Products can turn on Packaging of vendor prices. The module fills it with each vendor price's pack size, so it can be switched on at any time; Dolibarr then rounds purchase quantities to whole packs everywhere, including Replenishment. It is optional: the module rounds purchase order lines itself. With Dolibarr 24.0.1, editing a purchase order line's quantity with Packaging on keeps the total of the quantity typed (a Dolibarr issue, fixed after 24.0.1).

Limits

  • Shipment and reception quantities are typed in base units (the pack is shown beside them).
  • A line keeps its unit while its quantity is a whole number of packs; otherwise it shows in base units.
  • Templates that print neither a unit column nor descriptions (e.g. the merou shipping label) show base units.

Compatibility

  • Dolibarr 23 and 24: verified on clean installs of 23.0.4 and 24.0.1 (installed from the zip). Works with Multicurrency.
  • PHP as required by Dolibarr (tested on 8.3), MySQL / MariaDB.
  • English and French. Translations welcome.

Screenshots