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

Products Attributes and Variants creation using External API

Suscribirse

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

Se marcó esta pregunta
apiExternal
2 Respuestas
6282 Vistas
Avatar
Farooq Abbas

I am trying to create a Product in Inventory

id = models.execute_kw(db, uid, password, 'product.product', 'create', [{'name': "Green Ball"}])

I am looking for help to add product Attribute and Variants using external api.How the query would be build?

Like: 

Attribute:Color and Values:White



0
Avatar
Descartar
BradKrane

Did you ever get an answer or figure this out because the documentation regarding this is nonexistent or wrong everywhere I look

Farooq Abbas
Autor

It's difficult to understand underlying architecture of oddo External API. I found documentation insufficient.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,


To add product attributes and variants using the Odoo XML-RPC API, you need to understand the structure of the product attributes and variants in Odoo.
Here's how you can build the query to add a product with attributes and variants:


1. First, you need to create product attributes and attribute values if they don't exist. Then, you can link them to the product.
2. Create a product template and link the product attributes to it.
3. Create product variants based on the product template.
Here's a step-by-step guide on how to achieve this:# Define your product attributes and their values
attribute_values = [(0, 0, {'name': 'White'})]  # Adjust this according to your attribute values

# Create product attributes if they don't exist
attribute_id = models.execute_kw(db, uid, password, 'product.attribute', 'create', [{'name': 'Color'}])

# Create attribute values if they don't exist
attribute_value_ids = models.execute_kw(db, uid, password, 'product.attribute.value', 'create', attribute_values)

# Create a product template and link the product attributes to it
product_template_id = models.execute_kw(db, uid, password, 'product.template', 'create', [{
    'name': 'Green Ball',
    'attribute_line_ids': [(0, 0, {'attribute_id': attribute_id, 'value_ids': [(6, 0, attribute_value_ids)]})]
}])

# Create product variants based on the product template
product_variant_id = models.execute_kw(db, uid, password, 'product.product', 'create', [{
    'name': 'Green Ball - White',
    'product_tmpl_id': product_template_id,
    'attribute_value_ids': [(6, 0, attribute_value_ids)]
}])


Hope it helps

0
Avatar
Descartar
Benjamin ROCHE

I think there is a mistake as for the last step, he should update (and not create) the product variants based on the product template (product variants are automatically created from product template)

Avatar
Oscar González
Mejor respuesta

You must use the model product.template.attribute.line, with relation to producs on the field product_id.


The problem you'll face, could be get the Attribute Id, cause the records are created by id, not by name. I created a method thats gets the ID from the name using the odoorpc package in python.

0
Avatar
Descartar
Farooq Abbas
Autor

I am able to find support
https://www.odoo.com/forum/help-1/map-product-attribute-value-pair-using-odoo-api-201652
But 'value_ids':[(6,0,[2,4)] key-value pair is not comprehensible. Is there any support available?

¿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
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
ago 25
1238
Using API check if Odoo is using Odoo sh or on-premises hosting. Resuelto
api
Avatar
Avatar
1
ago 25
1594
External API XMLRPC Authentication Keeps Replying with false
api
Avatar
Avatar
Avatar
2
jul 25
4492
API xmlrpc - upload pdf bills to account Resuelto
api
Avatar
Avatar
Avatar
3
jul 25
1671
Odoo API connection credential - How to get these credentials?
api
Avatar
Avatar
1
jun 25
3526
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