# Uom Conversion Inter category on product

**URL:** https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219
**Category:** Feature
**Tags:** purchasing, sales
**Created:** [March 5, 2019, 10:46am UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219 "2019-03-05T10:46:45Z")
**Posts on this page:** 13
**Page:** 2

<div class="post-metadata">

### Author: ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)
#### Post date: [March 19, 2019, 10:46pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/21 "2019-03-19T22:46:16Z")

</div>

> [@albert](#):
>
> The idea with these modules is that the new UoM is only necessary as a communication tool (information) with the other party (supplier in this case). So Tryton keeps its current behaviour and the information UoM simply helps encoding or telling the supplier how much amount in their unit we need.

In that same way we implemented hard weight uom as information measure for customer/supplier in invoice, sale and purchase [1].  
Note that standard UOM’s invoice line is increased automatically along its category in order to preserve amount precision (weight amount == uom amount).

[1] [https://bitbucket.org/datalife\_sco/trytond-account\_invoice\_weight](https://bitbucket.org/datalife_sco/trytond-account_invoice_weight)

---

<div class="post-metadata">

### Author: ![lukio](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/lukio/32/98_2.png) [@lukio](https://discuss.tryton.org/u/lukio)
#### Post date: [March 20, 2019, 4:42pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/22 "2019-03-20T16:42:21Z")

</div>

> [@albert](#):
>
> We developed the purchase\_information\_uom module [1], which depends on account\_invoice\_information\_uom [2]. The idea was to create the sale\_information\_uom if ever required (we had it in OpenERP).

I developed sale\_information\_uom based on purchase\_information\_uom some time ago. You can check it out.

- [https://bitbucket.org/lukio/trytond-sale\_information\_uom](https://bitbucket.org/lukio/trytond-sale_information_uom)

---

<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 28, 2019, 12:56pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/23 "2019-03-28T12:56:36Z")

</div>

I started to work on this topic: [Allow conversion between UoM of different categories (#8238) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue8238)  
But now, I’m wondering how to name modules and how much modules to create. The main issue is that the second UoM is mainly needed on sale and purchase but both will create stock moves and invoices to which a second UoM will be filled. But on the last documents, the same field could be used by sale and purchase.  
So if I create two modules `sale_second_uom` and `purchase_second_uom`, I will need to create at least one or two modules `account_invoice_second_uom` and `stock_second_uom`. But those modules will be useful only if at least one of the first module is activated.  
Another option is to create a single module `product_second_uom` which will depend on `stock` on `account_invoice` and extra\_depends on `purchase` and `sale` to add the second uom conditionally.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [March 28, 2019, 1:09pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/24 "2019-03-28T13:09:40Z")

</div>

My vote is for single module option “product\_second\_uom”. It is not needed to create multiple modules if there’s extra\_depends.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 28, 2019, 1:13pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/25 "2019-03-28T13:13:07Z")

</div>

> [@ced](#):
>
> Another option is to create a single module `product_second_uom` which will depend on `stock` on `account_invoice` and extra\_depends on `purchase` and `sale` to add the second uom conditionally.

I think this is the cleaner solution as it will avoid the need to create additional dependencies which will only be useful if one of the first is activated.

Do you think it’s possible to make the product\_second\_uom module depend only on product and add account\_invoice and stock dependency as extra depends?

---

<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 28, 2019, 1:23pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/26 "2019-03-28T13:23:03Z")

</div>

> [@pokoli](#):
>
> I think this is the cleaner solution as it will avoid the need to create additional dependencies which will only be useful if one of the first is activated.

On a second thought, this module may still lead to the same state as with a `account_invoice_second_currency` if any `purchase` or `sale` is activated.

> [@pokoli](#):
>
> Do you think it’s possible to make the product\_second\_uom module depend only on product and add account\_invoice and stock dependency as extra depends?

Maybe but I’m wondering if it will not be too much complex for the benefit of reduce from 4 modules to 1.

Also we already have the `analytic_*` case with similar design.

---

<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 28, 2019, 3:21pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/27 "2019-03-28T15:21:58Z")

</div>

> [@ced](#):
>
> So if I create two modules `sale_second_uom` and `purchase_second_uom` , I will need to create at least one or two modules `account_invoice_second_uom` and `stock_second_uom` . But those modules will be useful only if at least one of the first module is activated.

But it has the advantage that for example some setup may need only of `sale_second_uom` but still use `purchase`.

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [March 28, 2019, 9:44pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/28 "2019-03-28T21:44:29Z")

</div>

> [@ced](#):
>
> > So if I create two modules `sale_second_uom` and `purchase_second_uom` , I will need to create at least one or two modules `account_invoice_second_uom` and `stock_second_uom` . But those modules will be useful only if at least one of the first module is activated.
> 
> But it has the advantage that for example some setup may need only of `sale_second_uom` but still use `purchase` .

That’s the reason why we created a separate module. However, maybe it could be a single module and make it configurable. After all, invoices will need those fields anyway.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 29, 2019, 9:09am UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/29 "2019-03-29T09:09:56Z")

</div>

> [@albert](#):
>
> That’s the reason why we created a separate module. However, maybe it could be a single module and make it configurable. After all, invoices will need those fields anyway.

But does it really hurt to have the second UoM fileds on purchase but only use when needed?  
For me it’s not a big problem to have the fields available but do not use.

Indeed we have the same issue for companies selling services only, that they have the stock module activated but they do not use.

For me it’s important to reduce the number of modules so we keep the system simple and reduce the maintenance costs.

---

<div class="post-metadata">

### Author: ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)
#### Post date: [March 29, 2019, 9:41am UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/30 "2019-03-29T09:41:48Z")

</div>

I prefer one module with extras\_depend and a good set of tests for each scope (product, sale, purchase and invoice).

---

<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 29, 2019, 11:59am UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/31 "2019-03-29T11:59:03Z")

</div>

> [@pokoli](#):
>
> For me it’s important to reduce the number of modules so we keep the system simple and reduce the maintenance costs.

I think having a single module will increase the complexity because you will need to have a test to detect if purchase or sale in activated.

Also I think it will be good to be able to choose to display secondary unit on stock or not (idem from invoice).  
So for me, the 4 modules could not depend on each others.

---

<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 29, 2019, 3:53pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/32 "2019-03-29T15:53:53Z")

</div>

I created [Add secondary unit (#8239) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue8239) with for now `sale_secondary_unit` and `account_invoice_secondary_unit`.  
As you can see they are not depending on each other which provides a good flexibility of configuration. So for me, it is the right grain of modularity.

---

<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: [August 11, 2019, 4:00pm UTC](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219/33 "2019-08-11T16:00:00Z")

</div>

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

[Previous page](https://discuss.tryton.org/t/uom-conversion-inter-category-on-product/1219.md?page=1)
