# Need to find purchases by products

**URL:** <https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416>\
**Category:** Ideas\
**Tags:** purchasing\
**Created:** [May 24, 2019, 2:29pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416 "2019-05-24T14:29:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 24, 2019, 2:29pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/1 "2019-05-24T14:29:24Z")

</div>

We’re missing a feature in Tryton which we **heavily** used in Openerp, namely the means to be able to navigate to related purchases from the product [variant] form or even directly filter from the tree of purchases.

Has anybody already taken the time to patch this functionality into Tryton?  
Invoices lines also have product relations, for that matter…

On this same note, there is a ‘product cost history’ function on products, it might be nice to tag onto that in order to get to the purchase and/or invoice.

---

<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:** [May 27, 2019, 8:11am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/2 "2019-05-27T08:11:23Z")

</div>

> [@risto3](#):
>
> We’re missing a feature in Tryton which we **heavily** used in Openerp, namely the means to be able to navigate to related purchases from the product [variant] form or even directly filter from the tree of purchases.
> 
> Has anybody already taken the time to patch this functionality into Tryton?  
> Invoices lines also have product relations, for that matter…

IIRC we have added this functionality as a customization for customers a couple of times. But I’m not sure this should be part of standard modules.

> [@risto3](#):
>
> On this same note, there is a ‘product cost history’ function on products, it might be nice to tag onto that in order to get to the purchase and/or invoice.

I’m not sure to understand you here. Could you clarify what are you missing here? Probably it’s worth to start a new topic as it seems related to the product cost history but not to purchases and products

---

<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:** [May 27, 2019, 8:28am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/3 "2019-05-27T08:28:55Z")

</div>

Here’s a custom module which add a relate on product variant to get purchase\_lines:  
[https://bitbucket.org/saluc/purchase\_history/src/default/](https://bitbucket.org/saluc/purchase_history/src/default/)

---

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 27, 2019, 4:28pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/4 "2019-05-27T16:28:12Z")

</div>

> [@pokoli](#):
>
> I’m not sure to understand you here. Could you clarify what are you missing here? Probably it’s worth to start a new topic as it seems related to the product cost history but not to purchases and products

Once in product cost history, it should be possible to navigate to each purchase or invoice… it appears now that only a cost price history graph is displayed if I click on a single dated entry in the list.  
Totally non-intuitive… I would expect to open the purchase (or eventually invoice) at that date.

---

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 27, 2019, 4:28pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/5 "2019-05-27T16:28:59Z")

</div>

Merci Maxime… I’ll take a look.

---

<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:** [May 28, 2019, 7:37am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/6 "2019-05-28T07:37:19Z")

</div>

> [@risto3](#):
>
> Once in product cost history, it should be possible to navigate to each purchase or invoice… it appears now that only a cost price history graph is displayed if I click on a single dated entry in the list.  
> Totally non-intuitive… I would expect to open the purchase (or eventually invoice) at that date.

But product\_cost\_history module does not depend on the purchase nor on the invoice modules.

BTW probably it’s better to add the missing information on the product\_cost\_history list. What invoice/purchase information are you missing?

---

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 28, 2019, 5:24pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/7 "2019-05-28T17:24:38Z")

</div>

> [@pokoli](#):
>
> But product\_cost\_history module does not depend on the purchase nor on the invoice modules.

?? Where does the cost price come from in this case?  
The only pertinent value could be from the purchase and/or invoice!

---

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 28, 2019, 5:26pm UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/8 "2019-05-28T17:26:27Z")

</div>

> [@pokoli](#):
>
> BTW probably it’s better to add the missing information on the product\_cost\_history list. What invoice/purchase information are you missing?

Perhaps, but it would be best to at least add the relates in order to be able to navigate quickly to the relevant purchase order or invoice.

---

<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:** [May 29, 2019, 7:38am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/9 "2019-05-29T07:38:49Z")

</div>

> [@risto3](#):
>
> Perhaps, but it would be best to at least add the relates in order to be able to navigate quickly to the relevant purchase order or invoice.

To me, it’d make a lot of sense if both sale and purchase modules added a relate button from product.product and product.template to sale.line and purchase.line.

It’s a frequently asked feature.

---

<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:** [May 29, 2019, 7:50am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/10 "2019-05-29T07:50:26Z")

</div>

> [@risto3](#):
>
> ?? Where does the cost price come from in this case?  
> The only pertinent value could be from the purchase and/or invoice!

Thes shown are the history of change of the product. Normally this is updated when receiving the stock moves but if a user manually changes the product cost price this changes will also be in the history and does not come from a invoice nor a purchase.

---

<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:** [May 29, 2019, 7:54am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/11 "2019-05-29T07:54:02Z")

</div>

> [@albert](#):
>
> To me, it’d make a lot of sense if both sale and purchase modules added a relate button from product.product and product.template to sale.line and purchase.line.
> 
> It’s a frequently asked feature.

Could you elaborate which is the rational? Why are users asking this feature?

I’m not sure if this will solve the problem. For example, if the idea is to know on which supplier are we purchasing a specific product the information should be on the purchase.product\_supplier table and not on the purchase lines.

If the data is not on the product supplier probably we are missing some automation to add this supplier to the product after some purchases.

---

<div class="post-metadata">

**Author:** ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)\
**Post date:** [May 31, 2019, 11:51am UTC](https://discuss.tryton.org/t/need-to-find-purchases-by-products/1416/12 "2019-05-31T11:51:42Z")

</div>

> [@pokoli](#):
>
> Thes shown are the history of change of the product. Normally this is updated when receiving the stock moves but if a user manually changes the product cost price this changes will also be in the history and does not come from a invoice nor a purchase.

It seems difficult to justify any cost price history that is not invoiced, or minimally a confirmed purchase order. All others more or less detract from the real economic measure, read even be _wrong_!

I see, for example, in the cost price history of products imported at the last date for migration (18/01/19) that some (not having been purchased yet) have a price of 1€ (!), then for example, 3 prices for today even though the purchase/effective stock move/and invoice date are different for these.  
Luckily there wasn’t any special reduction or the prices would probably have been wrong for the latter as well.
