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
    • e-learning
    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
    • Conocimientos
    • 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 pub
    • 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
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • 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
    Explorar todos los sectores
  • 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
    • Servicios para 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

get product category id in product_id_change

Suscribirse

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

Se marcó esta pregunta
sale.order.line
1 Responder
10491 Vistas
Avatar
mohamed abdelwahed

hello everybody i want to get the product category_id from the product_id_change() from sale.order.line :)

0
Avatar
Descartar
Diego Calzadilla

Hi, I have done it, but it gave some strange results, well the first thing I did was: In a re-defintion of product_id_change I wrote these lines ...sale_line_id = self.search(cr,uid,[],context=context) and then: for line in self.browse(cr, uid, sale_line_id, context=context): category_id = line.product_id and line.product_id.categ_id.id and then it returns a product_id and categ_id which is not in the quatation I'm working on....it's supossed that product_id_change works on the product im choosing to add in my saleorderso,so ...

Diego Calzadilla

why does it go and brings the category of the last product of my firts confirmed quatotion?? does any of you guys have any idea?. Thanks!

Avatar
Keyur
Mejor respuesta

You can simply get category_id in sale.order.line by using browse method of sale_order_line in product_id_change method. Just need to pass sale_order_line id in it.

order_line_brw = self.pool.get('sale.order.line').browse(cr, uid, ids, context=context)

or

order_line_brw = self.browse(cr, uid, ids, context=context)

Then

category_id = order_line_brw.product_id and order_line_brw.product_id.categ_id

This will give you browse record of category if you want category_id then just need to add .id at the end

Like this

category_id = order_line_brw.product_id and order_line_brw.product_id.categ_id.id
0
Avatar
Descartar
mohamed abdelwahed
Autor

sorry but i get this error category_id = order_line_brw.product_id and order_line_brw.product_id.categ_id.id AttributeError: 'browse_record_list' object has no attribute 'product_id'

Keyur

It is because of ids is in list. Try to write it in for loop for example, for order_line_brw in self.browse(cr, uid, ids, context=context): or you can write ids[0] instead of ids. That will solve your problem.

Diego Calzadilla

Hi, I'm having the same problem, has any of you been able to solve it?. When I try the for loop, nothing happens, The debugger says: Nameerror: name order_line_brw is not defined. And if I write ids[0] wheter in order_line_brw = self.browse(cr, uid, ids, context=context or in the for loop instead of ids, I get the following error: for order_line_brw in self.browse(cr, uid, ids[0], context=context): IndexError: list index out of range

Diego Calzadilla

Thanks in advance for suggestions!!

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to add a sequence a field? Resuelto
sale.order.line
Avatar
Avatar
Avatar
2
dic 24
22407
add product upon saving sales order
sale.order.line
Avatar
0
sept 24
1585
Odoo 17 remove product_uom from sale_order_lines
sale.order.line
Avatar
Avatar
Avatar
3
ago 24
3152
invoice/sales
sale.order.line
Avatar
0
feb 24
2330
invoice
sale.order.line
Avatar
0
feb 24
1650
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