“sale_subscription” only deals with subscriptions on fixed amounts (fixed quantities and fixed unit prices). For our needs and customer needs we want to invoice according to third party data in Tryton.
Some examples :
- Make a subscription on the management, the quantity corresponds to a time consumed / spent on a project.
- Charge commission, my customer provides direct sales service from theses customers to theses suppliers. The unit price is calculated according to the amount invoiced in the period by theses suppliers, it can be fixed, indexed on a rate or linked to a conversion grid.
- Quantity to invoice is provided by an external API (Marketplace, website, …)
I propose to modify the “sable_subscription” module or to add an additional module in order to be able to add in the subscriptions the possibility of defining unit quantities and / or prices via third-party models / APIs.
It would be far too complicated to have a fully configurable system, there are too many possible cases. I propose to add 2 hooks via selection fields. One to fix the quantity when creating consumption lines. the second to set the unit price when creating the invoice line. The values of the selection fields are the responsibility of the modules offering the third party.
By default the selection fields use the quantity and unit price found on the subscription line, maintaining the current behavior.
- Add in the module timesheet the hook to get the quantity depending on the time cosummed
- Add the implementation of the commission on the sale or the invoice in function of the rate or a conversion grid.