Automatic validation of invoices from subscriptions

automatic validation of invoices from subscriptions

Rational

“sale_subscription” only creates invoices, in some cases we would like these invoices to be validated / posted automatically.

Proposition

I propose to add a field selection on the subscription to determine the state of the invoice created (draft, validated or posted). We take the current behavior as default value(state is draft), otherwise the state chosen will be applied at the creation of the invoice.

Implementation

Future

Indeed this is not limited to the invoice of subscription. We could have the same need for the invoices created by sale.

The initial idea about not posting automatically is to have the accountant to review them. This is usually needed for the first invoices created for a customer but also using a product.
So my idea would be that we could have a module that post automatically invoices if they look like invoices already posted. I think this could be done by a scheduled task.
But another problem will raise with such automation is how to ensure that the invoices are sent to the customer. We will probably need to have a flag to mark an invoice as sent and we need that for example the notification module fill this flag.

Yes indeed the need is greater than mine. I would rather have simpler rules than scheduled tasks.

We could use the origin on the invoice to determine whether it should be posted or not. A mixin could be added to the referenced models as well as a default value in the configurations.