Skip to Content
Menu
This question has been flagged
5 Replies
10269 Views

Hello, 


INTRODUCTION

You can jump directly to the question if you want...

We are evaluating Odoo 14 as our accounting program as we have an old system that works, but needs a complex architecture (One data server (linux), one license server (windows) and then n client computers).  This old system starts to fail and we are willing to migrate to a newer thing.

I'm a programmer, not an accountant, but I'm in charge of validating the options we are thinking about.

Then, we are thinking on a dockerized Odoo system inside a NAS, which could be accessed from everywhere using a simple web navigator.


THE QUESTION ITSELF:

Our accountant department manager is telling me she can't delete invoices.

Of course this is not a normal practice, but in case of making a mistake she would like to be able to do it.

She is aware she can set the invoice to draft again and then update it, but in case it's the last invoice before closing the year (or any other accounting milestone), she would like to remove it from the system, of course, before being paid...

This should be able to be done in both invoices to customers and from vendors.


How can this be done?


As an example (now I have only 3 invoices in the demo system) 2 in vendors and one in customers.

I have both vendor invoices cancelled and not paid, but even that, I can't remove those invoices from the system.

In the invoice I have in the customers section, it sports a draft status and it's neither paid, but can't be deleted.


In all cases the message that appears is:

You cannot delete an entry which has been posted once.



Notice I'm trying to do this from the administrator account, so it must not be a privileges issue.


Thank you very much in advance.
Avatar
Discard
Author

It works, thanks you very much!


I guess then we should go through the journal items and do the same with the elements that are related to that invoice...


Is that right?  can this be automated?


Thank you very much again.

Hello, i tried doing this but I am unable to delete.

Best Answer

Once the invoice is validated/posted, it cannot be deleted. But there is still an option to delete the invoice forcefully.

Follow the following steps:

1) Enable developer mode and click on Edit Action:


2) Add 'force_delete': True in the Context Value field which will allow you to delete the invoice:



Avatar
Discard

This seems rather dangerous, as it would allow any invoice to be deleted, overriding the validation in Odoo.

This is just a temporary option to delete the invoice. Of course, it is dangerous if the user deletes the wrong invoice by mistake. So the user will have to be careful before deleting the invoice.

In which case it might be better to create a new menu option for Force Delete with only the Administrator authorized to use it.

Best Answer

As    Sudhir Arya  said :

  but  better  to  put True  in  quote:    'force_delete': 'True' 

my old context value:

{'default_move_type': 'out_invoice'  }

my new context value:

{'default_move_type': 'out_invoice' ,  'force_delete': 'True'}

This  worked for  me.


Avatar
Discard
Best Answer

I also changed the context value and seems like i had an typo in it.

Now i'm not able to open the accounting module any more. Where can i change this context entry from technical settings menu? Or how can i access the "Edit action" window when not able to open the needed page?

Avatar
Discard

You can use the menu (in debug mode) Settings / Technical / Actions / Actions

I can find the action there but I can't find a way how to edit the Context field there. Any idea?

Best Answer

Hello! I did this , and cannot acces invoice view . 

ERROR:

Traceback:
Error: Expected "}", got "(end)"
Please let me know how I can fix this ? 
Avatar
Discard
Best Answer

I experienced the same as Elizabeth Sandhya. Took me a while to figure out what the problem was, therefore maybe for future reference see below.

In step 2 of the answer of Sudhir Arya, there is a discrepancy between the red text and the screenshot itself. Basically there were two options that worked for me: 'force_delete': 'True' (4 quotes) was succesful, and also 'force_delete': True (2 quotes). Not sure which is the official method, but both worked for me.

However the key to making this work for was to go in two steps: First add the "force_delete" stuff and save. Than "leave" the invoice by restarting the accounting menu and open the invoice again. If I skipped this intermediate step, the system would not allow me to fully delete the invoice.

Avatar
Discard