top of page
  • Writer's pictureTek Siong, Hock

How To Delete A Specific Company in Odoo

By Rajeel Zahid


You cannot simply delete a company from Odoo views, as there are many defined constrains on its related data. So here is the brief guide how you can solve this problem.


Step 1: Get the schema of database and extract all constrains from the schema and save it somewhere.


Step 2: Make a copy of extracted constrains and change all constrains to CASCADE

(Note: If there are tables exception like you do not want to delete res.partner or res.users or ir.attachments data you can SET NULL to their constrains)


Step 3: Drop all constrains from database and alter tables with new constrains


Step 4: If also want to delete main company, update company_id (which will be new main) on usable data like website, calendar and exception tables and etc and also must update the company_id to public user to access the portal and login page.


Step 5: Delete SCSS files from database (will solve all the scss issues)


Step 6: Delete required companies


Step 7: Delete all ir.attachments which has URL like /web/content/ (will solve odoo.define issues)


Step 8: Revert the old schema by dropping all the constrains and alter the old extracted constrains


Additional: You may also have the requirement of deleting some tables which may has the 2nd or 3rd relation with res.company, so you can take care of this before Step 6

72 views0 comments

Recent Posts

See All

Odoo Element Cannot be Located in Parent View

Sometimes, after you've added a new field to the existing view, by inheriting the view, you may encountered the following error, when upgrading the module. Element 'XXXXX' cannot be located in parent

Commentaires


bottom of page