# Supply on sale with production request

**URL:** https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167
**Category:** Feature
**Tags:** production, sales
**Created:** [January 10, 2020, 1:28pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167 "2020-01-10T13:28:51Z")
**Posts on this page:** 10
**Page:** 1

<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 10, 2020, 1:28pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/1 "2020-01-10T13:28:51Z")

</div>

## Rational

Some business may require to produce on sale request. For example, when the production is very customized even for the same “product”. More on [Linking sales orders with productions - #12 by ced](https://discuss.tryton.org/t/linking-sales-orders-with-productions/1331/12).

## Proposal

A new module `sale_supply_production` is created which:

- Allow `supply_on_sale` for producible (salable and not salable)
- Create production request for producible line, store it on the sale line and set the sale as origin (like purchase request for purchasable)
- A Function field `production_request_state` is added to the line with the values: `''`, `requested`, `produced` or `cancel`.
- Assign the sale moves once the production is done

The design is very similar to the purchase request. So the `sale_supply` may be factored to ease the integration of production request (e.g. allow to reuse `assign_supplied`).  
The production request are also created for input product that has the `supply_on_sale` checked.

## Implementation

- [Production supply modules (#3257) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue3257)

---

<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: [January 14, 2020, 6:22pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/2 "2020-01-14T18:22:09Z")

</div>

I have some points that are not clear to me:

- What will be the behaviour of `sale_supply_production` in case of nested productions? I mean: one of the sale product inputs is another product that should be producible. Will be nested productions also created?
- What happens if the supply production wizard is executed and exists a production request linked to a sale? I think the supply wizard should not delete production requests created from a sale.

---

<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 14, 2020, 10:57pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/3 "2020-01-14T22:57:12Z")

</div>

> [@pokoli](#):
>
> What will be the behaviour of `sale_supply_production` in case of nested productions? I mean: one of the sale product inputs is another product that should be producible. Will be nested productions also created?

I think by default nothing should be done. So the `stock_supply_production` will be in charge of creating such production if needed.  
But we should allow to extend the behavior to force to create nested productions if it is needed.

> [@pokoli](#):
>
> What happens if the supply production wizard is executed and exists a production request linked to a sale? I think the supply wizard should not delete production requests created from a sale.

I agree the `stock_supply_production` should be updated this way.

---

<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: [January 16, 2020, 8:21pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/4 "2020-01-16T20:21:22Z")

</div>

> [@ced](#):
>
> > What will be the behaviour of `sale_supply_production` in case of nested productions? I mean: one of the sale product inputs is another product that should be producible. Will be nested productions also created?
> 
> I think by default nothing should be done. So the `stock_supply_production` will be in charge of creating such production if needed.  
> But we should allow to extend the behavior to force to create nested productions if it is needed.

I’m not sure if this is the best behaviour. We’ve found several cases that the production is done one demand and all of the components of the production should be produced in intermediate productions. So in this case it makes totally sense to create also nested productions.

I think we should allow the user to choose for each product if the production is “exploded on sale” or not.

---

<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 16, 2020, 9:05pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/5 "2020-01-16T21:05:56Z")

</div>

Indeed I think a better design is to create production order also for producible input that has the `supply_on_sale` checked. So this means that the checkbox should be visible even if the product is not salable.

---

<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: [January 16, 2020, 10:52pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/6 "2020-01-16T22:52:24Z")

</div>

For it’d be better to have a supply\_on\_production. In some scenarios users want to manually create a production but all the bom tree created and linked to the main production.

This way if a product is created by “supply\_on\_sale” the initial production will be created on the sale. Afterwards if some of the inputs of the production are marked as “supply\_on\_production” their productions will be created too.

---

<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 16, 2020, 11:55pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/7 "2020-01-16T23:55:52Z")

</div>

For me, it is not a correct design because the “nested” production requests must be created before the starting of the “parent” production. So `supply_on_production` will always be too late.

---

<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 10, 2020, 11:37am UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/8 "2020-03-10T11:37:18Z")

</div>

I have trouble with the “nested” productions. The main is that a production can be changed (quantities, BoM etc.) until it is running. So this means that creating nested order before will require a complex synchronization mechanism with major difficulties like: “What to do with a nested productions is running but the BoM of the main one is changed and no more required the running one”…  
I think the “nested” production is a false problem or at least it is not a good solution to the real problem.  
I see two cases:

- The production is indeed composed of multiple BoM (to ease management) but it should be treated as a single production. This should be solved with phantom BoM.

- The main production requires materials that are unique. So they are many possible improvements here:

So for me, the `sale_supply_production` should only manage to create the first level of production.

---

<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 10, 2020, 2:35pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/9 "2020-03-10T14:35:46Z")

</div>

Here is the proposal [Production supply modules (#3257) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue3257)

---

<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: [April 27, 2020, 4:00pm UTC](https://discuss.tryton.org/t/supply-on-sale-with-production-request/2167/10 "2020-04-27T16:00:06Z")

</div>

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