# Add energy to uom to product module

**URL:** https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907
**Category:** Ideas
**Created:** [February 7, 2023, 11:48am UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907 "2023-02-07T11:48:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [February 7, 2023, 11:48am UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/1 "2023-02-07T11:48:13Z")

</div>

## Rational

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.

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [February 7, 2023, 12:07pm UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/2 "2023-02-07T12:07:37Z")

</div>

Should we just add the basic units such as kWh and MWh, or also Joule, Mega Joule, BTU, calorie?

---

<div class="post-metadata">

### Author: ![adeseg99](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/a/977dab/32.png) [@adeseg99](https://discuss.tryton.org/u/adeseg99)
#### Post date: [February 7, 2023, 12:29pm UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/3 "2023-02-07T12:29:22Z")

</div>

If we would be adding energy unit we should go for the main units and wait to see if we have high demand of it.

---

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [February 7, 2023, 1:51pm UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/4 "2023-02-07T13:51:21Z")

</div>

There is a Python package called [Pint](https://github.com/hgrecco/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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [February 7, 2023, 1:53pm UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/5 "2023-02-07T13:53:04Z")

</div>

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.

> [@dotbit](#):
>
> 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.

The rule is to use the base (or derived) of [SI](https://en.wikipedia.org/wiki/International_System_of_Units) 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.

> [@dotbit](#):
>
> Should we just add the basic units such as kWh and MWh, or also Joule, Mega Joule, BTU, calorie?

We try to just add the most common so: kWh (maybe MWh). For [BTU](https://en.wikipedia.org/wiki/British_thermal_unit) I would avoid it as its value is not really standard. Idem for [calorie](https://en.wikipedia.org/wiki/Calorie).

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [February 14, 2023, 1:20pm UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/6 "2023-02-14T13:20:48Z")

</div>

> **[Add energy uom category and units to product (!293) · Merge requests · Tryton...](https://foss.heptapod.net/tryton/tryton/-/merge_requests/293)**
>
> Following add-energy-to-uom-to-product-module

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](https://www.tryton.org/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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 6, 2023, 7:00am UTC](https://discuss.tryton.org/t/add-energy-to-uom-to-product-module/5907/7 "2023-03-06T07:00:52Z")

</div>

This topic was automatically closed after 14 days. New replies are no longer allowed.
