Energy has become an important topic lately, from an environmental point of view and also security point of view (geopolitical or cost).
As more companies take responsibility for their energy, for environmental, cost or subsidy reasons some of these companies have to invoice the excess solar energy to the power company in order to be paid for it. For this we need energy units.
I believe that as Tryton is both open source and free software we should acknowledge energy by adding the units by default and make it just a little bit easier for the user to invoice excess energy.
Usage
energy unit necessary for Invoicing produced energy, paying energy bills, and also for including energy cost in things like productions.
Implementation
Add a Uom category called energy, and the units to uom.xml of product module
Initially I wanted to use Joules as base unit, because that is the base unit in physics, but I think it is more realistic to use kWh as the base unit.
There is a Python package called Pint which does all the unit conversion. Maybe that package can help to import units the way countries and currencies are imported. The user can then choose which units have to be imported.
I think we did not include unit of energy because it is not really stockable.
But now I think this should not be a blocker to add them.
The rule is to use the base (or derived) of SI as base in Tryton.
Also it is not a problem if most users are not using the base unit as long as we set correct factors.
We try to just add the most common so: kWh (maybe MWh). For BTU I would avoid it as its value is not really standard. Idem for calorie.
I have done what I can to make sure that my first merge request is ok.
I skipped creating an issue since that was not mentioned in Tryton - How to Develop
Added Energy category, J and kWh. The only uncertainty I have is if MJ or J should be used as base unit since a Joule is a very small amount of energy that has no practical use.