Jump to content
Sign in to follow this  
barneby

Delete invoice hook

Recommended Posts

Hello,

I need to perform a custom action after deleting the invoice, but I can't find any hook that would allow me to do this.

How can I perform a custom action after deleting an invoice?

Thank you.

Share this post


Link to post
Share on other sites

It's not really a good idea to delete invoices because of the accounts!

You should rather cancel invoices that are incorrect or that are not to be paid.

Share this post


Link to post
Share on other sites

Yes, when the Proforma Invoice is in a separate number series, you can delete these.

Share this post


Link to post
Share on other sites
Posted (edited)

Ok. How can I perform a custom action after deleting an proforma ?

Edited by barneby

Share this post


Link to post
Share on other sites

There is no InvoiceDeleted hook index.
If you want to catch it, you should cancel and use InvoiceCancelled.

Share this post


Link to post
Share on other sites
On 8/12/2022 at 12:45 PM, barneby said:

I use pro forma invoicing. If it is a prpforma invoice, I can delete it.

You can, but you can't...

Sometimes it may happen that you delete a proforma, but the corresponding rows (stored in a different table) are not deleted.

So it happens that:

- you delete proforma id 12345

- rows of deleted proforma id 12345 stay and are not deleted

- you create a new proforma and... guess, its number will be the last one available,12345!

- in the proforma you have just created your user will find the the rows of the "previous" proforma id 12345 (even if they were of a different user)

So, a great mess...

Right way to do:

- never delete proforma: always just cancel them

- if you want to delete them, do it for any of them but the last one (with the higher id)

   

Share this post


Link to post
Share on other sites
2 hours ago, Remitur said:

You can, but you can't...

Sometimes it may happen that you delete a proforma, but the corresponding rows (stored in a different table) are not deleted.

So it happens that:

- you delete proforma id 12345

- rows of deleted proforma id 12345 stay and are not deleted

- you create a new proforma and... guess, its number will be the last one available,12345!

- in the proforma you have just created your user will find the the rows of the "previous" proforma id 12345 (even if they were of a different user)

So, a great mess...

Right way to do:

- never delete proforma: always just cancel them

- if you want to delete them, do it for any of them but the last one (with the higher id)

   

great explanation. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated