Allow pending invoice accounts in invoices

We have several customers that register account moves for pending invoices and later they need to create invoices with this accounts to reconcile the moves.
The goal is normally to get the expense/revenue on the current period.

Let me show examples for customer an supplier:

  1. Supplier invoice
  • Create the move from 624 (expense) to 4109 (pending supplier invoices) at 30/4/21 for Party 1
  • Create the Party 1 invoice at 4/5/21 from 4109 (pending invoices) to 4100 (payable).
  1. Customer invoice
  • Create the move from 700 (revenue) to 4009 (pending customer invoices) at 30/4/21 for Party 2
  • Create the Party 2 invoice st 4/5/21 from 4009 (pending invoices) to 4000 (receivable).

Recently was added a “debt” option on account type for supplier invoices but it is limited for assets. Moreover no option exists for customer invoices.

I find in trytonspain account module this new functionality but I think it could be part of account foundation module.


This is implemented by Account Invoice Defer Module — trytond_account_invoice_defer latest documentation

IIUC correctly what you describe is:

  1. Whenthe purchase or sale order is confirmed the system creates a move for the expense/revenue with the pending invoices amount
  2. When the invoice is posted, the amounts from the pendings invoices are moved to the customer payable/receivable.

There are some doubts from my side:

  • This should be done for all orders or just by some ones?
  • What if the order is cancelled? On which periods the amounts should be reverted?

So the expense/revenue is done when the order is confirmed but not when the invoice is received.

Indeed this is not a debt but a receivable/payable account diferent from the payable one.

Not sure what such functionality is for, maybe @albert or @resteve can clarify it.

But what you are describing reminds me this modules:

Sorry but I don’t see how it feets on this module.

That is. The move on point 1 could be done manually but of course it will be better automatically on sale/purchase confirmation.

Indeed if a company decided to work on this way is for all orders.

On same period of initial move.

It adds two booleans “customer_balance” and “supplier_balance” on account type and extend account domain on invoice lines to allow accounts with this fields checked (for customer invoice and supplier invoice respectively).

Yes I know about this modules; and they implement theses processes.

There are diferent things:

  • Defer is to distribute an expense/revenue into several periods
  • What is described there is accounting the expenses or revenue before receiving the invoice.

IIRC the main usage of this moves is to include on the receivable and payable balances the amounts of sales/purchases that have been already ordered but they have not been received yet.

Ok but we should fallback to the next open period in case this period has been already closed.
I asume the initial move should be done on the date the sale_date or the purchase_date.

WTF? This is crazy, how is it possibly allowed?

What is the goal to register before they are actually due (nor even precisely known)?
Any way I do not see why you should corrupt the accounting for such behavior.

There is one case where you could create the move for an invoice not yet received or posted.
This is at the end of an fiscal year if you have already receive the goods but not the invoice or if you have sent the goods but not yet invoice the customer. If you receive/post the invoice in the next period before the closing of the fiscal year, you can of course use “account invoice defer” to register it on the right year.
But if it is not the case, indeed you can book an estimation of the future invoice. In this case the proper way is the post a move between expense/revenue and pending invoice and post the cancellation of this move in the first period of the next year. This way when you receive/post the real invoice, there is nothing special to do.

I guess this could be automated by a wizard to run before closing the fiscal year which will search for purchase and sale that are received/sent (even partially) and based on this stock moves it create the adjustment moves (without forgetting the pending tax account).

Indeed you may register it when you already paid for it but you did not receive the invoice.

Sincerly, what I explained on my previous post is what I implemented on the mentioned modules but I think we need to search for the rational before going further.

There is no need for such behavior with accrual accounting. You just book the payment it will be reconciled later when you receive the invoice.

For me the only valid case is

but for sure you will not do that for every purchase or sale.

I disagree. You also want that to close each month correctly if you want to have the right P&L and balance reports. If you do that only the last month of the year you can get rare results on December comparted to the other months.

That is, say you apply what you suggest (and let’s consider that you’ve got an online shop so sales have the invoice and delivery in the same date but purchases have some delay):

Then in December 2021 you’ll have some expenses corresponding to November 2021 + the ones of December. But in January you’ll have fewer because the delayed ones will go into February.

December will have more expenses than it should and January fewer.

Let me clarify that what I disasgree with is that it only applies to end of fiscal year.

Doing that per purchase/sale is complex and we’ve discussed several times internally that it’d probably be better and easier to compute that information as a process for the end of the month. We try to minimize the usage of those modules because of their complexity, and in fact, the one based on sales it’s known not to work correctly in all cases. It’s not being used in production currently.

This is not really a problem. When I say fiscal year, it may also use period (for the rare companies who need more often).

Instead of searching for purchase and sale, we could simply search for non-posted invoice lines.

Ok, but the thing is that we need the date at which the service or goods where delivered. Maybe a Function field could be added to invoice lines that computes the “delivered” date, that picks the effective_date of the moves linked to the invoice line in the case of goods.

I have to discuss internaly but it sounds good to me with the option to run by period for (not so) rare companies. :face_with_raised_eyebrow:

AFAIK the amount for the adjustment move should be only the untaxed amount. Nothing to do with tax.
Here an example:

I think we can just use the end date of the period wher are creating the lines.

I’m wondering if it will be good to have a way to recall the amount when receving the invoice (like we do on the account_deposit module). This will allow the user to just select an amount an the system will create a line for the right account up to the current invoice amount (it may be the case that there amount is splited into several invoices).

I disagree. An invoice line may be created in 1st may because the supplier shipment was introduced in the system on that day but the effective date of the stock move be set to 30th April.

What is the purpose of this proposal? Do you intend to manage profit that is not recorded by shipments?

Sure. Taxes must not be taken into account. Taxes are earned (not sure what the right verb is here – merited??) on invoice, not when the goods are delivered.

Well we do not really need a date. But only if the invoice line was “received” before a date (the end date of the period). This can be simply computed from the ratio of stock moves linked that have an effective date before the date. For service I guess we can use the create date until we have Issue 9999: Add module to allow services to be invoiced when they are done - Tryton issue tracker.

Well I have here the French accounting rules and they book the taxes (of course not on the deductible account but on a pending tax account). For me this makes sense as the goal is also to have an up to date balance sheet but also the income statement.
Any way I guess if no pending tax account is defined then it will be ignored.

You do not have to recall any amount because globally the two moves are null (just like for invoice defer that’s why I made reference to it).

They are not booked on deductible taxes account but on another to get correct income value.

How the second move will be created?
From what I understood you need to use the pending invoices account instead of the expense/revenue when receiving/issuing the invoice and this creates the compensation move.

We need a way to select the right account on invoice, so this seems similar to the recall but updating the account of the lines? Or do you think we should automatically set the pending invoice account directly on the move once the invoice is posted?