# How to export the number of sold products in a period?

**URL:** https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441
**Category:** User
**Tags:** sales
**Created:** [March 12, 2020, 12:16pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441 "2020-03-12T12:16:15Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jcm](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jcm/32/344_2.png) [@jcm](https://discuss.tryton.org/u/jcm)
#### Post date: [March 12, 2020, 12:16pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/1 "2020-03-12T12:16:15Z")

</div>

Hi,

We need to export the total count by product sold through a period (really invoiced, not only on Sales because sometimes invoices are changed after the sale is complete).  
It seems that the column named “#” in the Sales \> Reporting \> Sales then by product represents the number of sales containing one or more products, but it’s not the sum(quantity).

Similarly we need to export the total count by product from or to a stock location through a period. Should we use a direct SQL query on the db?

---

<div class="post-metadata">

### Author: ![herrdeh](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/herrdeh/32/821_2.png) [@herrdeh](https://discuss.tryton.org/u/herrdeh)
#### Post date: [December 29, 2021, 12:24pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/2 "2021-12-29T12:24:23Z")

</div>

I’ve got the same question.

== sales \> reporting \> sales \> sales per product  
looks like a good place to start with, but it only displays “revenues” and “#” - but not the actual number.

I know  
== product \> relate \> product quantities by warehouse  
but that does not sum up.

Total numbers of items sold in a period of time really are important - there should be a very easy and obvious feature for that.

---

<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: [December 29, 2021, 12:47pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/3 "2021-12-29T12:47:16Z")

</div>

On product margins per product, there is the quantity that went out of the company.  
And it will not be difficult to sum the actual quantity on the sale reporting per product.

But we will need better argument to include it than “it should” and “it is important”.

---

<div class="post-metadata">

### Author: ![jcm](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jcm/32/344_2.png) [@jcm](https://discuss.tryton.org/u/jcm)
#### Post date: [December 29, 2021, 4:30pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/4 "2021-12-29T16:30:44Z")

</div>

> [@ced](#):
>
> But we will need better argument to include it than “it should” and “it is important”.

Hi Cedric,

For us as publisher, it’s necessary

- by law to report sales to author and compute their rights (number of books sold \* % \* public price)
- by contract with publisher we distribute: report them the sales by period.

A report in Sales would be perfect…

---

<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: [December 30, 2021, 9:43am UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/5 "2021-12-30T09:43:09Z")

</div>

Both seem to be dedicated reports as they need to group by author and by publisher.  
For the right computation I’m wondering if the commission module could not be used or something similar.

---

<div class="post-metadata">

### Author: ![jcm](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jcm/32/344_2.png) [@jcm](https://discuss.tryton.org/u/jcm)
#### Post date: [December 30, 2021, 10:04am UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/6 "2021-12-30T10:04:43Z")

</div>

For us, we need the total by title! ie by product, even if a title can be published in many formats (paper, epub) since each format has its own ISBN and price. So no grouping execpt by product.

The hard part is to be sure it’s a non zero invoiced sale: a sale with a cancelled invoice should not be counted, but neither should be a sale with a 100% rebate (=price zero) as some publisher emit zero invoice for free copies sent to newspapers (these copies don’t generate rights). We decided not to invoice free copies but simply do a stock move to client, so stock is changed without a sale nor an invoice, this should be easier to count sold copies.

---

<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: [December 31, 2021, 10:27am UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/7 "2021-12-31T10:27:56Z")

</div>

> [@jcm](#):
>
> The hard part is to be sure it’s a non zero invoiced sale:

Then probably your report should be based on the commission module (no commission for zero amount invoices) as already suggested. Does a Commission by Product solve your problem?

---

<div class="post-metadata">

### Author: ![herrdeh](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/herrdeh/32/821_2.png) [@herrdeh](https://discuss.tryton.org/u/herrdeh)
#### Post date: [January 11, 2022, 11:09am UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/8 "2022-01-11T11:09:10Z")

</div>

> [@ced](#):
>
> On product margins per product, there is the quantity that went out of the company.

Thank you very much for that hint. Great, there I can find what I was looking for.

Yet, I’m not totally convinced that it’s a good thing to have two “Reporting” menu entries with one sub-entry each (at least I have in my setup):

- Sales \> Reporting \> Sales
- Articles \> Reporting \> Margins

Both look very much related to each others, and both produce results which are not a property of the article itself, but of the sales process. So I think, Sales \> Reporting would be a better place for “margins”.

---

<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: [January 12, 2022, 7:46am UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/9 "2022-01-12T07:46:36Z")

</div>

But margin is not related to sale at all. It is only based on the stock moves and the product prices.  
Also it can be common that companies want different access right for each report.

---

<div class="post-metadata">

### Author: ![herrdeh](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/herrdeh/32/821_2.png) [@herrdeh](https://discuss.tryton.org/u/herrdeh)
#### Post date: [February 14, 2022, 5:25pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/10 "2022-02-14T17:25:06Z")

</div>

> [@ced](#):
>
> On product margins per product, there is the quantity that went out of the company.

My guess is that this feature calculates the overall margin of all items ever purchased and ever sold. True?

Although this is an interesting figure, I’d appreciate the margin of actually sold items; that would tell me more whether my prices are calculated accurately.

Cheers,  
Wolf

---

<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 14, 2022, 9:56pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/11 "2022-02-14T21:56:45Z")

</div>

> [@herrdeh](#):
>
> My guess is that this feature calculates the overall margin of all items ever purchased and ever sold. True?

It is computed based on outgoing stock moves.

---

<div class="post-metadata">

### Author: ![herrdeh](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/herrdeh/32/821_2.png) [@herrdeh](https://discuss.tryton.org/u/herrdeh)
#### Post date: [February 15, 2022, 12:00pm UTC](https://discuss.tryton.org/t/how-to-export-the-number-of-sold-products-in-a-period/2441/12 "2022-02-15T12:00:14Z")

</div>

Thank you for this clarification. Now I understand I have to look in my setup for reasons of odd results.
