Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Export external id directly from database?

Suscribirse

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

Se marcó esta pregunta
3 Respuestas
11230 Vistas
Avatar
Daniel Kauffman

I am migrating a database with thousands of products. Trying to export large numbers of images using the Odoo web interface is not possible due to resource limits on the server.

How can I export the external ids and the product images directly from the Odoo database?

0
Avatar
Descartar
Avatar
Daniel Kauffman
Autor Mejor respuesta

Looking at openerp/osv/orm.py in _get_external_ids() we can see that the external ids are stored in "ir_model_data" and can be tied to the models using "ir_model_data"."model" and "ir_model_data"."res_id".  So to dump product external ids and images to a CSV:

copy (select "ir_model_data"."module" || '.' || "ir_model_data"."name" as "id", encode("product_product"."image",'base64') as "image" from "product_product" left join "ir_model_data" on (("ir_model_data"."model" = 'product.product') and ("product_product"."id" = "ir_model_data"."res_id")) where ("product_product"."image" is not null)) to '/tmp/product.product.images.csv' with csv header;

Or to pipe data from the source server to another server, connect from the remote server to the source database using psql:

\copy (select "ir_model_data"."module" || '.' || "ir_model_data"."name" as "id", encode("product_product"."image",'base64') as "image" from "product_product" left join "ir_model_data" on (("ir_model_data"."model" = 'product.product') and ("product_product"."id" = "ir_model_data"."res_id")) where ("product_product"."image" is not null)) to 'product.product.images.csv' with csv header;

Alternatively, I suppose it would be possible to:

  • Export the database ids and the external ids using the Odoo web interface.
  • Export the database ids and images directly from the database.
  • Use a third-party tool and the database ids to associate the external ids with the images.
  • Upload the images to Odoo.

But exporting the external id directly, as described above, would in many cases be preferable.

Another alternative would be to script oerplib to stream data from an old database to a new database.

2
Avatar
Descartar
Avatar
nesefi
Mejor respuesta

Hi, i know this is kind of an old post but i would like to know where did you found the binaries for the images, im performing a similar export from odoo 12 and the interface export of images is broken

i used some similar queries to yours in this post but to no avail, there are no images in product_templates or product_product.

after some research i found out that for odoo 12 images are saved in ir_attachement in the field: datas_fname.

so i got this query

Select "id", "res_name", "datas_fname" from ir_attachment WHERE res_model = 'product.template' and "datas_fname" is not null;

and the result is this sample: 

https://docs.google.com/spreadsheets/u/7/d/1QR_HTSiYxUXOSl-2nS0MaDY7QHRMbux-43RhbB1eYak/edit?usp=sharing

there are no binaries in this table.

i made:

Select * from ir_attachment WHERE res_model = 'product.template' and res_field = 'image' and 'db_datas' is not null

to check all the fields from the table and got this other data set.

https://docs.google.com/spreadsheets/d/1g1zZrTLu56MU7S5O5nzg-QQtsLa8QaE7jflddnRb9Wo/edit?usp=sharing

where i got: no binaries at all

where di you got the binaries for your export?

kindly thank you very much.

0
Avatar
Descartar
Avatar
Juan Carlos Fdez
Mejor respuesta

Apologies for my ignorance but the where do you run the copy instruction? On a terminal, on postgresql, on python?

0
Avatar
Descartar
Daniel Kauffman
Autor

From a terminal, run psql to access your PostgreSQL database, then run the \copy command from psql. And of course test before you do anything in a production environment.

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

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

Inscribirse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 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