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 to retrive values in Many2one field as selection field?

Suscribirse

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

Se marcó esta pregunta
pythonmany2oneselectiononchangeodoo
2 Respuestas
17164 Vistas
Avatar
Mostafa Mohamed Abdel Monaem

How to retrieve values on Many2one field using OnChange ?

When i try to do so it gives me an error

'Expected singleton: fci.standard.groups(3, 4, 5, 6)'

I'm trying that when i change the standard field the group field will be updated to select only groups in this standard

Here is my fields

'standard_id': fields.many2one('fci.standard', string='Standard', required=True),

'group_id': fields.many2one('fci.standard.groups', string='Standard Group'),

Here is my function

def on_change_standard(self, cr, uid, ids, standard_id, context=None):

val = {}

if not standard_id:

return {}

student_obj = self.pool.get('fci.standard')

student_data = student_obj.browse(cr, uid, standard_id, context=context)

val.update({'group_id': student_data.groups_ids.id})

return {'value': val}

and here is my xml

<field name="standard_id" on_change="on_change_standard(standard_id)" widget="selection"/>

<field name="group_id" widget="selection"/>

0
Avatar
Descartar
Cyril Gaspard (GEM)

hi, you try to set a list of id in a many2one field which requires just one id, this not possible, you should have same type of field for group_id than groups_ids, if you want that values for group will be always the same in 2 class, use a field function type with type of groups_ids. bye

Avatar
Baiju KS
Mejor respuesta

Hi,

You can't pass more than one 'id' to a many2one field, that’s why you are getting error.

Its seems like you need domain filter , Please Check this :- (and add a proper filter for this field :   <field name="group_id" widget="selection"/>    )


Simple condition in programming:

if field1 = 10

In OpenERP domain filter, it will be written as:

syntax : Each tuple in the domain has three fields -> (‘field_name’, ‘operator’, value)

field_name : a valid name of field of the object model or in the database table

operator : valid operators are =, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_right (openerp/osv/expression.py)

value : a valid value to compare with the values of field_name, depending on its type.

ie, domain = [(‘field1′,’=’,10)] # where field1 should be a field in the model and 10 will be the value

or domain = [(‘field1′,’=’,field2)] # where field1 and field2 should be the fields in the model

Condition AND

Simple condition in programming:

if field1 = 5 and field2 = 10

In OpenERP domain filter, it will be written as:

ie, domain = [(‘field1′,’=’,5),(‘field2′,’=’,10)]

or domain = [(‘field1′,’=’,field3),(‘field1′,’=’,field3)]

Note : Note that if you don’t specify any condition at the beginning and condition will be applied.

Condition OR

Simple condition in programming:

if field1 = 5 or field2 = 10

In OpenERP domain filter, it will be written as:

ie, domain = [‘|’, (‘field1′,’=’,5),(‘field2′,’=’,10)]

or domain = [‘|’, (‘field1′,’=’,field3),(‘field1′,’=’,field3)]

Multiple Condition

Simple condition in programming:

if field1 = 5 or (field2 ! = 10 and field3 = 12)

In OpenERP domain filter, it will be written as:

domain = [‘|’,(‘field1′,’=’,5),(‘&’,(‘field2′,’!=’,10),(‘field3′,’=’,’12’))]


Hope this helps........

1
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
How to Use Many2one Field as selection for details?
many2one selection onchange
Avatar
Avatar
1
jul 19
7797
Filtering Many2one data based on selected status
filter many2one selection onchange
Avatar
Avatar
1
ago 23
2583
bug sort selection field in one2many(notebook) view
many2one selection sort notebook odoo
Avatar
Avatar
1
jun 24
2009
How can I create a selection of companies ? Resuelto
many2one selection res.company odoo v15
Avatar
Avatar
Avatar
2
nov 22
4036
Can't change custom field value that is on another model
python many2one account.move onchange account.move.line
Avatar
Avatar
1
abr 22
4155
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