# Sale Stock Quantity: Use the sale shipping date to calculate the forecast

**URL:** https://discuss.tryton.org/t/sale-stock-quantity-use-the-sale-shipping-date-to-calculate-the-forecast/5617
**Category:** Ideas
**Tags:** sales
**Created:** [October 18, 2022, 12:30pm UTC](https://discuss.tryton.org/t/sale-stock-quantity-use-the-sale-shipping-date-to-calculate-the-forecast/5617 "2022-10-18T12:30:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tbruyere](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/tbruyere/32/37_2.png) [@tbruyere](https://discuss.tryton.org/u/tbruyere)
#### Post date: [October 18, 2022, 12:30pm UTC](https://discuss.tryton.org/t/sale-stock-quantity-use-the-sale-shipping-date-to-calculate-the-forecast/5617/1 "2022-10-18T12:30:38Z")

</div>

Currently, the Sale Stock Quantity module displays a warning or an error message in case of quantity smaller than the forecast. But the module only uses the “Sale Date” in the context of calculating the forecast.

If we create a sale on today’s date with a shipping date in the future. If we don’t have the stock available on the current date, the system gives a warning on the forecast, even if we have placed a shipment date in the future (even if you have stock in the forecast on the shipping date indicated)

The user must check with a “relate” on the products the stock forecast to pass above the warning.

The date of the sale must be dated the current date of the order and not in the future.

I think the “Sale Stock Quantity” module should use the “planned\_shipping\_date” from the sale module as the date of the forecast calculation.

---

<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: [October 18, 2022, 12:51pm UTC](https://discuss.tryton.org/t/sale-stock-quantity-use-the-sale-shipping-date-to-calculate-the-forecast/5617/2 "2022-10-18T12:51:25Z")

</div>

Indeed the module was created before we have a shipping date on the sale line.  
But it is not that simple because we must check that placing the order will not prevent any other shipment until the next supply (or at max date if there is no supply delay).  
Also we must add other sales based on their shipping date and probably not restrict to a sale date before the current sale date.  
The change must be done in such way that it does not kill the performance because there are potentially a different shipping date for every line. Also it should use the grouping by date to compute product by location instead of adding days one by one.

---

<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: [July 12, 2023, 9:29am UTC](https://discuss.tryton.org/t/sale-stock-quantity-use-the-sale-shipping-date-to-calculate-the-forecast/5617/3 "2023-07-12T09:29:09Z")

</div>

See [Use shipping date instead of sale date to check stock quantity (#12388) · Issues · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/issues/12388)
