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: deprecated/tryton.wiki: e5cff9482830 ContractModule.wiki
- product (type: service)
- consumption rrule (optional)
- delay (optional, positive or negative)
- revision (increase each time it runs)
- invoice address
- start date (required)
- end date (optional)
- next invoice date (optional, can be before start date or after end date)
- invoice rrule (required)
- 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)
- 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)
- line (required)
- date (required)
- invoice line
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.
- 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.