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

Only show form field if a certain tag is set

Suscribirse

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

Se marcó esta pregunta
projectformtaskinvisiblestudio
2 Respuestas
1963 Vistas
Avatar
Björn

Hi all,


I want to show a form field of a project task only if the tag "PoC" is set. I tried the invisible condition:


[["tag_ids","=","PoC"]]

But it doesn't work. The field is always hidden with this condition, no matter if the tag is set or not. I have some automation's which also get triggered when a PoC tag is set. There the domain looks like this:


[["tag_ids.name","=","PoC"]]

Which works nicely for automation but if I try to use it for the invisible condition I get this error:


Error while validating view near:

<form string="Task" class="o_form_project_tasks" js_class="project_form" __validate__="1">
                    <field name="allow_subtasks" invisible="1"/>
                    <field name="is_closed" invisible="1"/>

Invalid composed field tag_ids.name in attrs ({"invisible": [["tag_ids.name","=","PoC"]]})

Any hints how to only show a form field if the tag "PoC" is set?


Thanks a lot!


0
Avatar
Descartar
Avatar
J.A. Daniel Göppner
Mejor respuesta

Hi Björn

as tag_ids is a manytomany I woul try to use 'in'

[["tag_ids.name","in","[PoC]"]]

or 

[["tag_ids","in","[your_id]"]]


Alternative you can create a computed field


display_fieldx = fields.Boolean(compute='_compute_display_fieldx')

@api.depends('tag_ids')
def _compute_display_fieldx(seld)
​for rec in self:
​ ​rec = any(tag_id.name == 'PoC' for tag_id rec.tag_ids)


then in form view
<field name="display_fieldx" invisible="1"/>

and use attrs ({"invisible": [["display_fieldx","=",False ]]}) for your field




hope this helps

Daniel

2
Avatar
Descartar
Avatar
Björn
Autor Mejor respuesta

Hi Daniel,


[["tag_ids","in","[your_id]"]]

gets accepted and it looks good, also the "visual" part of the rule builder (unfortunately I don't have enough karma points to post a screenshot or even a link to a screenshot :( ) 


But the field is shown afterward in all forms, no matter if the tag is set or not.


The other suggestion:

[["tag_ids.name","in","[PoC]"]]


Doesn't work, I get again a error message that tag_ids.name is not known:

Error while validating view near:

<form string="Task" class="o_form_project_tasks" js_class="project_form" __validate__="1">
                    <field name="allow_subtasks" invisible="1"/>
                    <field name="is_closed" invisible="1"/>

Invalid composed field tag_ids.name in attrs ({"invisible": [["tag_ids.name","in",["PoC"]]]})


I have the feeling that we are close to the solution but something is still missing.


Thanks!

Björn

0
Avatar
Descartar
J.A. Daniel Göppner

Hi Björn
i updated my answer with a second appraoch, hope this helps

Björn
Autor

Hi Jan,

I got it now working. First I had to find the ID of the tag which was not that easy. I inspected the HTML code to find it, than I had to turn "in" to "not in". This worked than:

[["tag_ids","not in",[5]]]

Thanks a lot for all your ideas and support!

¿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 open the project form view instead of task view in Odoo 17 CE?
project form task tree kanban
Avatar
Avatar
Avatar
2
jul 24
4957
Customize the Portal view
project task portal studio v15
Avatar
Avatar
1
feb 23
6703
Hide column in many2many field Resuelto
project xml task many2many invisible
Avatar
Avatar
1
jul 19
6269
v16 Tasks visibility
project task
Avatar
Avatar
1
jun 23
4126
Create a user who can only see project and task menu Resuelto
project task
Avatar
Avatar
1
nov 22
4545
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