with c_units.
Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements