# Subscription blueprint

**URL:** <https://discuss.tryton.org/t/subscription-blueprint/249>\
**Category:** Feature\
**Tags:** sales\
**Created:** [November 4, 2016, 2:43pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249 "2016-11-04T14:43:09Z")\
**Posts on this page:** 12\
**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:** [November 4, 2016, 2:43pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/1 "2016-11-04T14:43:09Z")

</div>

## Rational

Some business models are based on subscription. Those business needs a way to generate periodically invoices. Also some services could be stopped or added during the lifetime of the subscription.

Old reference: [http://hg.tryton.org/deprecated/tryton.wiki/file/tip/ContractModule.wiki](http://hg.tryton.org/deprecated/tryton.wiki/file/tip/ContractModule.wiki)

## Proposal

### Models

- sale.subscription.service
  - product (type: service)
  - consumption rrule (optional)
  - delay (optional, positive or negative)

- sale.subscription
  - company
  - number
  - revision (increase each time it runs)
  - reference
  - currency
  - party
  - invoice address
  - start date (required)
  - end date (optional)
  - next invoice date (optional, can be before start date or after end date)
  - invoice rrule (required)
  - lines
  - state: draft, quotation, running, closed, canceled

- sale.subscription.line (sequence ordered)
  - subscription (required)
  - service (required)
  - description (copy in party language from product service)
  - quantity (required, default 1)
  - UoM (copy from product service)
  - unit\_price
  - consumption rrule (copy from service)
  - consumption delay (optional, copy from service)
  - next consumption date (for optimisation)
  - start date (optional, inside subscription dates)
  - end date (optional, inside subscription dates)

- sale.subscription.consumption
  - line (required)
  - date (required)
  - invoice line
  - quantity

### Workflow

A running subscription could be set back to draft for edition but only some field will be editable if consumptions already exist like end date and the quantity.  
A cron task will run every day on lines with consumption rrule and a “next consumption date” - delay before today to create consumption record with the quantity from line. It will recalculate the “next consumption date” after.  
A second cron task will run on subscription with a “next invoice date” before today to create an invoice. The invoice is generated based on the consumption. The consumption used will be linked to the invoice line (like timesheet lines in project\_invoice). The taxes will be applied using the default taxes of the service product and using the tax rule of the party.

## Implementation

> **[Subscription module (#6043) · Issues · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/issues/6043)**
>
> Following: https://discuss.tryton.org/t/subscription-blueprint/249

## Future

- subscription with asset assignation, the subscription will create a shipment for assets needed to a customer location.
- subscription with shipment, the service will contain a list of goods to ship to the customer.
- subscription with asset assignation that can be sold. During the subscription, a customer may purchase the asset.

---

<div class="post-metadata">

**Author:** ![vincent](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/vincent/32/29_2.png) [@vincent](https://discuss.tryton.org/u/vincent)\
**Post date:** [November 8, 2016, 12:18am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/2 "2016-11-08T00:18:56Z")

</div>

Hey Cedric,

This is probably not relevant to your use case, but often a company does a subscription on a stockable item. So, the product on sale.subscription.service can also be something other than service.

---

<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:** [November 8, 2016, 9:03am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/3 "2016-11-08T09:03:36Z")

</div>

I guess you are talking about subscription that involve an asset. But it is always a service that is invoiced, the asset is only assigned. For this case, it will require an extra module to manage the assignation of the asset to the subscription.  
There is also another case where the subscribed service is about shipping some product recurrently. I guess the service should also be extended to define a list of product to ship and the consumption creation should also create the corresponding shipment.  
I add a Future section on the blueprint with those cases.

---

<div class="post-metadata">

**Author:** ![vincent](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/vincent/32/29_2.png) [@vincent](https://discuss.tryton.org/u/vincent)\
**Post date:** [November 8, 2016, 11:12pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/4 "2016-11-08T23:12:17Z")

</div>

In the future section you could also add the scenario whereby an asset ends up being sold during a subscription.

---

<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:** [November 9, 2016, 1:13am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/5 "2016-11-09T01:13:45Z")

</div>

You can add, it is a wiki post.

---

<div class="post-metadata">

**Author:** ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)\
**Post date:** [November 11, 2016, 11:53am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/6 "2016-11-11T11:53:00Z")

</div>

On SISalp business, the customer subscribes for a service which is to be renewed when it expires. Duration is 1 month or 12, 15 or 24 months

Some time before expiration, I warn him.  
He gets a renewal proposal. He can modify it to update his contract and confirms the renewal order.  
He pays the amount of the order for the duration set in the order.  
I renew the service on his new contract.  
I generate a paid invoice.

He might opt in for auto renew. In this case I send him a renewal order, wait for his payment and generate a paid invoice.

I don’t think this “ovh like” process will be compatible with the proposed design. Will it ?

---

<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:** [November 11, 2016, 11:59am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/7 "2016-11-11T11:59:38Z")

</div>

I do not see why it could not work.  
Of course the explicit renewal and the single invoice makes it less interesting because at the end it is similar to a classic sale.

---

<div class="post-metadata">

**Author:** ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)\
**Post date:** [November 11, 2016, 12:37pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/8 "2016-11-11T12:37:58Z")

</div>

It seems that the current design only considers periodic invoicing, which is a particular and limited use case.  
I guess that a design based on periodic order would fit both periodic invoicing by an auto-confirm order, and order based subscriptions which is more flexible imho. The fact that is is a classic sale is an advantage, I think. In case I need monthly payment on a 12 month contract I prefer use partial payment conditions and plan and partial invoicing.  
Today I manage my subscriptions by hand because I miss a module to do it.

---

<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:** [November 11, 2016, 1:31pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/9 "2016-11-11T13:31:39Z")

</div>

> [@SISalp](#):
>
> It seems that the current design only considers periodic invoicing, which is a particular and limited use case.

You can still have a period of one invoice.

> [@SISalp](#):
>
> I guess that a design based on periodic order would fit both periodic invoicing by an auto-confirm order, and order based subscriptions which is more flexible imho.

Creating a new sale is not a subscription because under a subscription the condition are not renegotiated on each period.  
What you describe is not a subscription but renewal process. And in this renewal process, the sale is/could be renegotiated.

> [@SISalp](#):
>
> The fact that is is a classic sale is an advantage, I think.

Of course, there is a need for a sale renewal module but the goal is different from the subscription.

> [@SISalp](#):
>
> In case I need monthly payment on a 12 month contract I prefer use partial payment conditions and plan and partial invoicing.  
> Today I manage my subscriptions by hand because I miss a module to do it.

This way of thinking is because you are talking about a sale where the service is prepaid no matter what will happen.

---

<div class="post-metadata">

**Author:** ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)\
**Post date:** [November 11, 2016, 2:35pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/10 "2016-11-11T14:35:49Z")

</div>

Yes, for me, by definition, subscription = sale renewal.  
In fact, I don’t really see in which case a subscription could be a periodic invoice. Which examples have been considered ?

---

<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:** [November 11, 2016, 2:43pm UTC](https://discuss.tryton.org/t/subscription-blueprint/249/11 "2016-11-11T14:43:41Z")

</div>

> [@SISalp](#):
>
> In fact, I don’t really see in which case a subscription could be a periodic invoice. Which examples have been considered ?

I have many:

- any rental (house, car etc.)
- commodity subscription (electricity, water etc.)
- phone, internet, broadcast subscription
- some hosting services (which invoice on consumption instead of fixed price)

Of course some do not have recurring consumption but manually created which this design takes into consideration. Also some of prepayment in addition that could be also implemented by extension.

---

<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 19, 2017, 9:50am UTC](https://discuss.tryton.org/t/subscription-blueprint/249/12 "2017-10-19T09:50:30Z")

</div>

Closed on October 19, 2017, 9:50am UTC


