# How to cancel posted customer invoice

**URL:** <https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891>\
**Category:** User\
**Tags:** sales\
**Created:** [June 17, 2020, 10:55pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891 "2020-06-17T22:55:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![andres53016](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andres53016/32/406_2.png) [@andres53016](https://discuss.tryton.org/u/andres53016)\
**Post date:** [June 17, 2020, 10:55pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/1 "2020-06-17T22:55:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeromarquez](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jeromarquez/32/452_2.png) [@jeromarquez](https://discuss.tryton.org/u/jeromarquez)\
**Post date:** [June 17, 2020, 11:18pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/2 "2020-06-17T23:18:13Z")

</div>

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](https://bitbucket.org/trytonspain/trytond-account_invoice_posted2draft) it is.  
Cheers!

---

<div class="post-metadata">

**Author:** ![andres53016](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andres53016/32/406_2.png) [@andres53016](https://discuss.tryton.org/u/andres53016)\
**Post date:** [June 17, 2020, 11:28pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/3 "2020-06-17T23:28:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [June 17, 2020, 11:48pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/4 "2020-06-17T23:48:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeromarquez](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jeromarquez/32/452_2.png) [@jeromarquez](https://discuss.tryton.org/u/jeromarquez)\
**Post date:** [June 17, 2020, 11:58pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/5 "2020-06-17T23:58:12Z")

</div>

> [@andres53016](#):
>
> I could cancel it from the database by passing the status of posted to cancel

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

---

<div class="post-metadata">

**Author:** ![andres53016](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andres53016/32/406_2.png) [@andres53016](https://discuss.tryton.org/u/andres53016)\
**Post date:** [June 18, 2020, 12:04am UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/6 "2020-06-18T00:04:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)\
**Post date:** [June 18, 2020, 12:41am UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/7 "2020-06-18T00:41:53Z")

</div>

Look at this thread

> [@How to credit and refund a posted invoice](https://discuss.tryton.org/t/how-to-credit-and-refund-a-posted-invoice/2412):
>
> In Tryton a credit note is an invoice with negative quantities. You can create it manually or let the system create it based on an existing invoice. In order to credit an existing invoice you should use the Credit action in the action menu: [imatge] The action will be executed with the current selected invoices, allowing you to credit multiple invoices. On the title you will see the invoice numbers that will be credited. If the with refund option is checked the credit note will be used to pa…

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [June 18, 2020, 6:07am UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/8 "2020-06-18T06:07:02Z")

</div>

> [@jeromarquez](#):
>
> We just use that module to the suppliers invoices. [He](https://bitbucket.org/trytonspain/trytond-account_invoice_posted2draft) it is.

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)

---

<div class="post-metadata">

**Author:** ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)\
**Post date:** [June 19, 2020, 10:33am UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/9 "2020-06-19T10:33:06Z")

</div>

> [@ced](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [June 19, 2020, 11:15am UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/10 "2020-06-19T11:15:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [June 19, 2020, 12:06pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/12 "2020-06-19T12:06:22Z")

</div>

> [@albert](#):
>
> Could you explain what you mean to have unbalanced reconciled lines and how can the module lead into that situation?

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).

---

<div class="post-metadata">

**Author:** ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)\
**Post date:** [June 19, 2020, 3:09pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/13 "2020-06-19T15:09:38Z")

</div>

> [@ced](#):
>
> 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.

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](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:

> <https://github.com/NaN-tic/trytond-account_invoice_posted2draft/blob/main/invoice.py#L68>

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:

> [@pokoli](#):
>
> 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 that can only happen with [account\_move\_draft](https://bitbucket.org/trytonspain/trytond-account_move_draft) module installed. It has nothing to do with account\_invoice\_posted2draft.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [June 19, 2020, 3:14pm UTC](https://discuss.tryton.org/t/how-to-cancel-posted-customer-invoice/2891/14 "2020-06-19T15:14:12Z")

</div>

> [@albert](#):
>
> But the move is not only reset to draft it is later deleted

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

> [@albert](#):
>
> it only allows ignoring the check if “draft\_invoices=True” is found in the context

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](https://discuss.tryton.org/t/how-to-credit-and-refund-a-posted-invoice/2412).
