Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How can I delete or archive a company?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
companies
4 Respuestas
32387 Vistas
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
Mejor respuesta

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

4
Avatar
Descartar
Avatar
Steven Segers
Mejor respuesta

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
Mejor respuesta

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
Mejor respuesta

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

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Como elimino una compañia(empresa) adicional que se creo y no tiene ningun movimiento Resuelto
companies
Avatar
Avatar
Avatar
2
abr 22
179
Error entering companies Resuelto
companies
Avatar
Avatar
1
ago 19
3235
Concept (without multi-companies) of creating other companies Resuelto
companies
Avatar
Avatar
Avatar
Avatar
3
jul 25
3813
comparision between open erp and i cloud erps
companies
Avatar
0
mar 15
4481
Selecting multiple companies instead of one in v7?
companies
Avatar
0
mar 15
5116
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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