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

restrict activate/archive Button to special group

Suscribirse

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

Se marcó esta pregunta
4 Respuestas
10487 Vistas
Avatar
Jack

how can i restrict the activate/archive Button (right top of the Products-Detail-Page) to a specifiv group?

i just could use xpath to make it invisible but i tried to set readonly to //button[@name='toggle_active'] and also //button[@name='toggle_active']  but it seems not to work.


any help?


0
Avatar
Descartar
Avatar
Avinash Nk
Mejor respuesta

Hi Jack,

You can add the group directly to a button.

Check this example code.

<button name="toggle_active" groups="base.group_no_one" type="object" class="oe_stat_button" icon="fa-archive">
    <field name="active" widget="boolean_button" options="{"terminology": "archive"}"/>
</button>

Here instead of groups="base.group_no_one" you can use your group.


Thanks

0
Avatar
Descartar
Jack
Autor

but how can i simply make it readonly for non authorized users? they should see that it is currently archived but they should not be able to reactivate it. the readonly attribute did not work for me

Avinash Nk

For fields, you can't make it readonly for some groups directly like doing for models. you can only hide them.

There are indirect ways. you can do this by inherit the write function and checking the condition as per your need.

Avatar
Ibrahim Boudmir
Mejor respuesta

Hi, 

This is actually possible regardless of what Avinash says. The idea is to add the attribute disabled="true" to your button. 

In order to do that ( since it's based on conditions like the specific group ), you will need to follow these steps : 

1- Js : call the FormController and specifically function renderButtons.
2- The conditions you need to check are : your model because if not it these changes would apply on all toggle_active buttons. 
3- RPC call to check the user's groups in python side ( very simple solution ). The function call will return True is user has group ( to whom the button won't be 'clickable' )
4- in JS, if result, then :  point your button with a specific class in XML to be easily identified and then : $('.o-your-class-here').prop('disabled', true);
​

All these steps are a little bit complicated to put together. So even it's true to be possible, you may consider just Hiding the button with groups. It's much easier.

Upvote if this helps.
Regards.

1
Avatar
Descartar
Avatar
Vasilis Zartilas
Mejor respuesta

Inherited the 'active' field and add groups and specify which groups you want to have access to it.

(Note: For Action -> Archive)

For example:

from odoo import api, fields, models

class HrAppraisalInherited(models.Model):
   _inherit = "hr.appraisal"

   active = fields.Boolean(groups="hr.group_hr_manager")
0
Avatar
Descartar
Avatar
fudo
Mejor respuesta

Please try this:

https://www.linkedin.com/pulse/how-hide-archiveunarchive-dropdown-specific-users-groups-yadav/?trk=articles_directory

This need a bit of modify to work in odoo 15 and above, but it's the correct way

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

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

Registrarse
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