Community mailing list archives

Re: database cleanup

Dave Ellison
- 12/03/2015 07:04:42

I would agree with this when deleting data that relies on other tables. You would need to back track and delete any data relating to that record. Which can become complicated, depending on the specific record you want to delete.

I would do this in a few ways, if you want to push from test to live, personally I would go with having a test database and production system. Pull data from the test that you want and push into your production system. You have various ways, one I prefer is to user Odoo's own export/import options. Export your data from test and import them into product system. That way, you get the data you want and it's in good shape. You could write some code to transfer data across if you know what you are doing.

Assuming you are using VM's. The other way would to get your base data in for example, your customers, products etc. Make either a copy of the VM, or do a snapshot. Test the system by entering invoices etc. Then either revert your snapshot back to the base data setup. With that, you will have a production copy ready to use. Or use the copied VM and fire it up as a separate instance as your product version, once the test has been signed off.

Personally, I just transfer the data to the production system and also once you make some development changes on test for your users to test. You will need to make those changes in production, after being signed off. So really you need two separate systems, as taking test and just making that production every time is not going to work. Personally, once you go live, you really need three seperate systems Test/Development, UAT and production anyway. This way you can develop whilst not affecting any user testing and a production system people can work on.

A very quick and dirty email on how to do this and it's something that needs to be setup first. Because as soon as your system goes to production, I guarantee you will be making changes that requires a separate system to test in.


On 02/12/15 15:27, Ray Carnes wrote:
<blockquote cite="" type="cite">
In general it is a bad idea to use SQL for anything other than reading your data.

Changing data via SQL has a very high risk of putting your system into an inconsistent state because you bypass business logic. Odoo wasn't written to handle changes to the storage layer outside the API.

If you log SQL calls, learn the data model and do lots of testing you can attempt this, but is a very advanced topic.


From: Andreas Becker
Sent: ‎12/‎2/‎2015 7:12 AM
To: Community
Subject: Re: database cleanup

This is a very good question - Keeping your database clean should be easy as it would be good to do this every year at least.


With kind regards,
Mit freundlichen Grüßen,
Con un cordial saludo,
с сердечным приветом,
เรื่องที่ เกี่ยวกับชนิด,


CEO/General Manager LisAndi Co., Ltd.


LisAndi Co. Ltd., Phuket, Thailand (
15/21 M.2 Viset Road, Rawai, Muang, Phuket, Thailand 83130

Mobile: +66 (0)81 606 3378
VoIP:   +49 (0)711 50 88788 50
Fax:     +49 (0)711 50 88788 50
Skype:          lisandi
Facebook:     andibecker
Google Talk/Facetime/eMail:


This email may contain confidential and/or privileged information. If you are not the intended recipient (or have received this email by mistake), please notify the sender immediately and destroy this email. Any unauthorized copying, disclosure or distribution of the material in this email is strictly prohibited. Email transmission security and error-free status cannot be guaranteed as information could be intercepted, corrupted, destroyed, delayed, incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which may arise as a result of email transmission

On Wed, Dec 2, 2015 at 8:34 PM, Nhomar Hernández <> wrote:

There is not an easy way with one click but depending which transactions there is pretty easy to achieve a list of tables affected and clear them with an SQL.

At least the ones you mentioned:

Remember reset also the sequences.

But there is an opportunity there when we began with Odoo we look for such module but we never did it :-(

On Wednesday, 2 December 2015, Franco Ordoñez <> wrote:

Is there some way or some module to do a database movement transactions cleanup, I mean i have configured odoo in test environment , created customers, products, have done all configuration everything is tested and successfull. to rollout to production i would like to have some option to delete invoices, whs transactions, account transactions but not delete customers, products, configuration, etc.

Hola comunidad
Existe alguna manera o algun modulo el cual nos permita hacer un borrado de las transacciones de una base de datos, Ejemple he creado una base de datos de test y ahi creamos clientes, productos, configuramos y todo esta ok, ahora para pasar a produccion nos gustaria una opcion que elimine movimientos o transacciones como facturas, movimientos de bodega, contabilidad, etc. pero sin que borre los clientes, productos ni las configuraciones.

Muchas Gracias

- Franco Ordonez

Post to:

Saludos Cordiales

CEO at Vauxoo Odoo's Gold Partner.
Nhomar Hernandez

Post to:

Post to:

Post to: