Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How can I delete or archive a company?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
companies
4 Respostes
32381 Vistes
Avatar
Ivan Coro

In V10 enterprise, For some models there's an archive function, but not for company. If I have multiple companies but then I have a company that is out of business, how can I disable or archive this company so that it does not appear in all modules? It seems that once a company is created even if I don't have any transactions yet, I cannot delete it because I get an error of referential integrity in the database and the archive function is not available for companies. Please help.

0
Avatar
Descartar
Avatar
Ray Carnes
Best Answer

Did you try removing access to that Company for all users?

4
Avatar
Descartar
Avatar
Steven Segers
Best Answer

I know it's an old post, but as deleting a company is not addressed anywhere and this was the first hit when I googled it, I figured I could add a suggestion here on how to delete a company.


As Dheeraj pointed out, to delete a record you must first delete all records in other tables that relate to it. As almost everything in Odoo relates to a company, it is probably going to be quite a tedious and time consuming job to do that through the UI. So, an easier approach to do this is through the database. 


1. Check which Id the company has by querying the companies table:


select * from res_company rc;


2. Execute the following update


update res_company rc set resource_calendar_id = null where id = 123; -- Replace 123 with the id of your company


3. Execute the following select to generate a bunch of delete statements to delete all data related to the company:


SELECT 'delete from ' || columns.table_name || ' where ' || columns.column_name || '= 123;' -- Replace 123 with the id of your company
FROM information_schema.columns
join information_schema.tables t on columns.table_catalog = t.table_catalog and columns.table_schema = t.table_schema and columns.table_name = t.table_name
where (column_name = 'res_company_id' or column_name = 'company_id' or (t.table_name = 'res_company' and column_name = 'id')) and t.table_type = 'BASE TABLE';

4. Now execute the delete statements.


Depending on your exact situation, you may get some constraint violations when executing the delete statements. You'll have to resolve those in the appropriate way:

  • Reorder the statements to first delete items referencing another table

  • Set foreign key fields to null in case of circular dependencies (step 2 is an example)

I also found that some tables do not reference res_company directly. For example, account_payment does not reference res_company. So you have to derive the company from a related table. For example:

delete from account_payment ap where journal_id in (select id from account_journal aj where company_id = 123);


In my database I also found records of company A referencing records of company B, but let's not dwell on that :)


It goes without saying that the above advice comes without any guarantee whatsoever and a big warning: BE CAREFULL

  • Make sure you have a backup before you start

  • Try on a test-database first

  • Only do this when you understand what you are doing. Don't just execute these statements blindly.

If you end up with an empty production-database: too bad for you :)


(For some reason this text editor keeps screwing-up my text. I really struggled to get the queries above in, so it's possible some space or character ended up dropping off)

6
Avatar
Descartar
Avatar
Dheeraj Balodia
Best Answer

As per my knowledge,  you have to remove that company details from everywhere than only you can be able to delete the company. Let's say if a company is used in some accounting than you have to delete the accounting first and then delete the company

0
Avatar
Descartar
Avatar
Mahmoud Abdelwahid
Best Answer

You can inherit 'res.company' model and add Boolean 'active' field , then in this company make active = False

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Como elimino una compañia(empresa) adicional que se creo y no tiene ningun movimiento Solved
companies
Avatar
Avatar
Avatar
2
d’abr. 22
179
Error entering companies Solved
companies
Avatar
Avatar
1
d’ag. 19
3234
Concept (without multi-companies) of creating other companies Solved
companies
Avatar
Avatar
Avatar
Avatar
3
de jul. 25
3813
comparision between open erp and i cloud erps
companies
Avatar
0
de març 15
4481
Selecting multiple companies instead of one in v7?
companies
Avatar
0
de març 15
5113
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now