This is an accounting practice when the company receives an invoice for an expense that covers multiple periods or emits an invoice for a revenue that also covers multiple periods.
The goal is to defer the part of the expense or revenue proportionally over the covered periods.
In a new module
account.configuration we add two deferred account for expense and revenue.
We add on new model
- invoice line:
account.invoice.linewith a domain constraint on the type and a unique constraint
When running, it creates and post for each existing standard
account.period found (except that one used on the invoice) between start and end date, an account move that credit the deferred account and debit the line account. And for the period used on the invoice it debit the deferred account and credit the line account of the sum of all other moves.
The run state can be executed as long as all the date range is not covered by periods moves.
The ratio between each period is computed based on a daily amount.
A check on
Period.close a check is done to ensure that all deferred have been run.