Re: database cleanup

by

Dave Ellison

- 12/03/2015 07:04:42

Hi,

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.

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.

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

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.