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

how to make the "mark done" disappear depending on a condition

Suscribirse

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

Se marcó esta pregunta
5 Respuestas
2320 Vistas
Avatar
Aws Hokan

How to change the XML code so that if the signed in user is the assignee user in a certain activity then the "mark done" button should appear to the mentioned user, if the signed in user NOT the assignee user the "mark done" button disappear.
the Activity.xml file that I think should change


0
Avatar
Descartar
Aws Hokan
Autor

Thanks Jason for response but i tried as you suggest but not working. the code appear as the following :
<button class="o_Activity_toolButton o_Activity_markDoneButton btn btn-link btn-primary pt-0 ps-0"
t-att-title="activityView.markDoneText" t-ref="markDoneButton" t-on-click="activityView.onClickMarkDoneButton" attrs="{'invisible': [('user_id', '!=', uid)]}"
>
<i class="fa fa-check"/> Mark Done
</button>

Aws Hokan
Autor

Thank you all for replay. I tried the mentioned solution but still face the same result.
I think that the condition is true but the parameters are false ( the assignee Id and the singed in user id)

Avatar
Jason Vu
Mejor respuesta

Hi,

you can try to add this to your button: 

attrs="{'invisible': [('user_id', '!=', uid)]}"

Hope it helps!

1
Avatar
Descartar
Avatar
Osama Hassan
Mejor respuesta

Hello aws hokan, Jason Vu provided sample code for such operation as you didn't provide you code snippet earlier.
Try this

attrs="{'invisible': [('activity_assignee_id', '!=', uid)]}"

upgrade module and clear browser cache as sometimes the cache prevents from changes made in xml/js file.


1
Avatar
Descartar
Avatar
Jainesh Shah(Aktiv Software)
Mejor respuesta

Hello Aws Hokan, 


We can achieve this by defining a new Boolean field and we have to compute it's value based on our condition. Now, We'll use this field in the attrs of the "mark done" button. 

Please find code in comment.

Kindly let us know if you face any issue.

Hope it will be helpful to you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

0
Avatar
Descartar
Jainesh Shah(Aktiv Software)

Please find code here :-

You can use below code.

# python code:

from odoo import api, fields, models

class MailActivity(models.Model):
_inherit = "mail.activity"

display_mark_done = fields.Boolean(compute="_compute_display_mark_done")
@api.depends("user_id")
def _compute_display_mark_done(self):
for rec in self:
rec.display_mark_done = self.env.user.id == rec.user_id.id

<!--xml code:-->
<!--We'll user 'display_mark_done' field in the attrs of 'mark as done' button like below.-->
<!--please make sure that the priority is set to 100 so that other views can't override our view.-->

<?xml version="1.0" encoding="UTF-8" ?>

<odoo>
<record id="mail_activity_view_form_popup_inherited" model="ir.ui.view">
<field name="name">mail.activity</field>
<field name="model">mail.activity</field>
<field name="priority" eval="100"/>
<field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_done']" position="attributes">
<!--other domains are coming from base view and we don't want to override it-->
<attribute name="attrs">
{'invisible': ['|', '|',
('display_mark_done', '=', False),
('activity_category', 'in', ['meeting', 'tax_report']),
('chaining_type', '=', 'trigger')]}
</attribute>
</xpath>
</field>
</record>
</odoo>

Avatar
Nimisha Muralidhar
Mejor respuesta

Hi

You will need to add a condition to the visibility of the button based on the current user's role as the assignee. Use the attrs attribute to define the condition.

Thank You

-1
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi 

Please try the code given below,

<button name="action_mark_done" string="Mark Done" type="object"
        attrs="{'invisible': [('user_id', '!=', uid)]}"/>

Hope it 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.

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 empresariales de código abierto que cubre 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