Odoo Help

0

How to delete the stock moves when they are in "done" state?

By
Salt and Light Energy Equipment
on 3/8/13, 2:26 PM 10,298 views

How to delete the stock moves when they are in "done" state?

3

Short answer - you cannot - for your own good.

This is a fundamental of double entry bookkeeping, every movement has a credit and a debit. It makes it easier to track where your money is going.

It is poor accounting practices to just re-write entries in the ledger. If you made a mistake, make a correcting entry that cancels out the old stock move. Like if you shipped it to a partner in the computer by mistake, create a return with a note that this was just a computer error.

If your database is getting too big, I would see about exporting the information somehow.

0
Ray Carnes
On 3/8/13, 2:46 PM

OpenERP prevents you from deleting stock moves that are not in the DRAFT state. If a stock move is DONE by mistake (should not have been completed), then you need to create another stock move that is the opposite of the mistake move.

I find it absurd that there is no safe way for the administrator to remove these records. In adjusting the workflow and testing it there are now dozens of test moves I want gone. I guess I have no choice but use SQL to force them all back to draft state so I can safely delete them. Ugly. Why can't the admin have tools for this that normal users will never access?

mike
on 5/24/13, 1:31 PM

100% agree. There are bugs that generate Stock moves that I need to delete but can't. For example, I have a Product set as Make to Stock that is in stock but a Delivery Order has somehow generated a Manufacturing Order and confirmed the stock moves. I need to delete that. I don't need to be protected from this.

Chris Jones
on 10/15/13, 12:22 AM

SQL is the method you can use if you don't want to be protected from the business logic. Make sure you understand exactly what you are doing.

Bista Solutions US, Ray Carnes
on 10/15/13, 2:08 AM
0
mike
On 10/15/13, 11:08 AM
update stock_move set state = 'draft' where id = ?;

Then you can delete them from within OpenERP safely. Or if safety is not a concern...

delete from stock_move where id = ?;

I don't recommend the latter but I've had to do it when a CSV upload test generated several hundred test records and I needed them gone for the next iteration of testing.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 3/8/13, 2:26 PM
Seen: 10298 times
Last updated: 4/13/16, 4:50 PM