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

dependent drop-down in odoo / open erp

Suscribirse

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

Se marcó esta pregunta
3 Respuestas
6753 Vistas
Avatar
Himanshu Mittal

I have made two drop-downs. Second dropdown's data is dependent on first drop-down's chosen value.

I have tried multiple methods, but didn't find any relevant solution.

Those are my three lists:

SELECTION_LIST = (('sela','Selected a'), ('selb','Selected b')) SELECTION_LIST_2 = (('selc','Selected c'), ('seld','Selected d')) SELECTION_LIST_3 = (('sele','Selected e'), ('self','Selected f'))

And I defined my fields this way:

'type_selection': fields.selection( [ ('selection1', 'Selection 1'), ('selection2', 'Selection 2'), ('selection3', 'Selection 3'), ], 'Category 1', required=False), 'type_selection_2': fields.selection( type_selection={ 'selection1': [{SELECTION_LIST}], 'selection2': [{SELECTION_LIST_2}], 'selection3': [{SELECTION_LIST_3}], }, "Category 2", required=False)

Unfortunately I get an error.

0
Avatar
Descartar
Avatar
Jacky
Mejor respuesta

It is better to use an Onchange method in these cases.

0
Avatar
Descartar
Avatar
Himanshu Mittal
Autor Mejor respuesta

have also used onchange function like this

In xml file ->

<field name="type_selection" on_change="_set_list_data(type_selection)"/> -->

<field name="type_selection_2"/>

In python file ->

'type_selection': fields.selection([
                                  ('selection1','Selection 1'),
                                  ('selection2','Selection 2'),
                                  ('selection3','Selection 3')
                                  ],'Select Call Reason',required=False),
        'type_selection_2': fields.selection(
                                             _get_selection,
                                             'What do you want ?')

 

python function 

 def _set_list_data(self,cr,uid,selected,context=None):
        if selected == 'selection1':
            SELECTION_LIST = SELECTION_LIST_2
            vals = {'type_selection_2': SELECTION_LIST_2}        
            return {'type_selection_2': SELECTION_LIST_2}
        else:
            vals = {'type_selection_2': SELECTION_LIST_3}
            SELECTION_LIST = SELECTION_LIST_3        
            return {'type_selection_2': SELECTION_LIST_3}
        
    def _get_selection(self, cr, uid, context=None):
        return SELECTION_LIST

0
Avatar
Descartar
Med Said BARA

In your .py file move the function definition before the _columns (fields definitions)

OdooBot
which function?

Warm Regards,

Himanshu Mittal | Trainee,Technology |himanshu.mittal@nagarro.com| 09649417940


Nagarro Software (P) Ltd, Plot No-14, Sec-18, Electronic City, Gurgaon, Haryana-122015, India

Visit our facebook page : https://www.facebook.com/nagarrocampus

  

P Please consider the environment and do not print this email unless absolutely necessary



On Wed, Oct 29, 2014 at 5:33 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

In your .py file move the function definition before the _columns (fields definitions)

--
Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

OdooBot
Le 29/10/2014 13:19, HImanshu Mittal a écrit :
<blockquote cite="mid:CAEZJQWfuK8P-nK-KuYPyZbWEPign4bq0jONMfdB1=QiLpN_-AQ@mail.gmail.com" type="cite">
which function?

Warm Regards,

Himanshu Mittal | Trainee,Technology |himanshu.mittal@nagarro.com| 09649417940


Nagarro Software (P) Ltd, Plot No-14, Sec-18, Electronic City, Gurgaon, Haryana-122015, India

Visit our facebook page : https://www.facebook.com/nagarrocampus

  

P Please consider the environment and do not print this email unless absolutely necessary



On Wed, Oct 29, 2014 at 5:33 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

In your .py file move the function definition before the _columns (fields definitions)

--
Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

--
Himanshu Mittal
Sent by OpenERP S.A. using Odoo about Forum Post False Both: def _set_list_data and def _get_selection.

Can you post the error message you are getting?

Best regards.
OdooBot
Hi,
Can you please look into this
http://stackoverflow.com/questions/26591360/dependent-drop-down-in-odoo-open-erp

Regards,
Himanshu Mittal
Avatar
Med Said BARA
Mejor respuesta

At first glance, there is a smell of (python) " Nested Lists".

But it will be helpful, if you give a concrete example, like for product's categories and subcategories, or Brand and Models of cars ...

0
Avatar
Descartar
Himanshu Mittal
Autor

Like We Say.. List 1 has Items -> Mobile,Laptop, Tablets List 2.1 (For Mobile) -> Samsung, Apple List 2.2 (For Laptop) -> Apple, Dell List 2.3 (For Tablet) -> Samsung, Dell, Apple How can I achieve the same

Himanshu Mittal
Autor

Any update on this??

Himanshu Mittal
Autor

Any update on this??

¿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