How to cancel posted customer invoice

Hi, my partner was wrong to load the amounts of the invoice. I want to cancel it to generate a new one with the appropriate amount, but since it is in a posted state, the cancel button does not appear.

I think you should credit it. There is an action on the invoice to do that. In another way, you can use a custom module that allows you to get it back to draft. This is not a good practice and, probably it is nonlegal in your country. We just use that module to the suppliers invoices. He it is.
Cheers!

We use tryton to carry the accounting part in an orderly manner, but since we are small taxpayers we do not need to present the transactions to the treasury. The invoice differs from the original amount, so I wanted to cancel it. From what I saw in the module you passed me I could cancel it from the database by passing the status of posted to cancel.

You can cancel supplier invoice in case of mistake because this has no impact on the communication as you have the correct supplier invoice on paper.
For customer invoice, most legislation does allow to cancel them only by posting a credit note. So you should make a credit note and generate a new correct invoice. If you did not send the wrong invoice to the customer, you can also not send the credit note to the customer. Otherwise you need to send the credit note and the corrected invoice.

1 Like

No, you can take it back to Draft, make the changes you need and get it Posted again.

1 Like

How could I make the credit note, why can’t I find it, should I cancel the sale? The sale has several invoices since a part is charged in advance and some of those are paid.

Look at this thread

1 Like

I would not recommend to use this module as it may break the integrity of the accounting. (Ex: it would allow to have unbalanced reconciled lines)

Could you explain what you mean to have unbalanced reconciled lines and how can the module lead into that situation?

The posted move being reset to draft allow the user to modify it. Indeed we have a second layer of check for the reconciliation. But it would be very easy to have different amounts between the invoice and the accounting move.

For example, if the invoice account is updated and the move receivable account is not updated this makes tryton display wrong amounts for the invoice total amount and base amount.

Same happens when the lines amounts are updated but no the move amounts. The sum of the lines amount does not match with the total of the invoice (which is computed from the move).

But the move is not only reset to draft it is later deleted by super():

https://hg.tryton.org/modules/account_invoice/file/tip/invoice.py#l1411

Also, although, the module inherits move’s check_modify method, it only allows ignoring the check if “draft_invoices=True” is found in the context, which is never the case, except when the invoice is moved to draft:

So I don’t understand in what situation you see that this module allows data to be inconsistent.

I guess the problem you’re talking about is what Sergi mentioned here:

But that can only happen with account_move_draft module installed. It has nothing to do with account_invoice_posted2draft.

Indeed, so now the problem is hole in the posting number.

So this can be used by malicious user to always skip this check.

Such feature is not available in Tryton because there are always integrity issues. Any way this is going off-topic and the standard process is already documented How to credit and refund a posted invoice.