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 Records in Timesheet Activities to User and Employees that are Managed by the User

Suscribirse

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

Se marcó esta pregunta
securityormactivityrecord_rulestimesheets
3 Respuestas
11704 Vistas
Avatar
Damian Bere

Context

We are using Odoo 9 Contracts Management functionality and need to record timesheets with tasks.  As this is not possible in the default entry form (see this post: https://www.odoo.com/forum/help-1/question/record-activities-time-against-project-tasks-in-odoo-9-timesheets-92869 )  we need to use the Activities view, which shows entries from the Analytic Account Line data model.


Problem

The current Activities view shows all records (all activities from all users for all analytic accounts).  

We want to show:

  • The entries related to that user

  • The entries related to employees that user manages, and

  • The entries related to Analytic Accounts / Projects Managed by the User

  • All entries when user is part of a specific Permissions Group (e.g. Human Resources / Manager, etc)


So Far...

  • We are using the record rules to filter what the user can see and are building this up step by step

  • We can successfully filter entries related to the user:  [('user_id','=',user.id)]

  • We tried to also filter where the user was the manager, but failed with many variations of the following:  ['|',('user_id','=',user.id),('user_id.manager_id','=',user.id)]   and  ['|',('user_id','=',user.id),('user_id.employee_ids.parent_id','=',user.id)]  and ['|',('user_id','=',user.id),('user_id.employee_ids.parent_id','child_of',user.id)]  etc etc  

We get exceptions like:  "user_id" not found in "hr.employee" table when using the child_of method, other times it will say no such field/leaf, and yet other times it will not report an error but wont show the expected records either.

Clearly we are just not understanding how to relate to the ORM model, but the documentation we've found doesn't seem to help a great deal (maybe we've missed something though).


Any help or guidance appreciated!


1
Avatar
Descartar
Avatar
Baiju KS
Mejor respuesta

Hi,

Everything is correct except manager rule :-

It should be ['|',('parent_id.user_id', '=', user.id),('user_id', '=', user.id)]

the left part cannot be 'user_id.manager_id' or 'user_id.employee_ids.parent_id'  because here user_id is many2one field to res.users and there is no field like .employee_ids and .manager_id in res.users that’s why it throws error.

For selecting manager's user id we have to select manager field and from there the user_id (here manger field is parent_id "many2one field refer to hr.employee itself") :-  'parent_id.user_id' .


Hope this helps.




2
Avatar
Descartar
Damian Bere
Autor

Thanks for the reply Baiju - it sounds sensible. Unfortunately I can't check this on our system at the moment due to other things going on, but will confirm when I do.

Avatar
oyunsuren
Mejor respuesta

Hello.

It is late answer. But maybe helps to some others.

I added following domain filter on Activities action.

['&',('is_timesheet', '=', True),'|',('user_id.employee_ids.parent_id.user_id', '=', uid),('user_id', '=', uid)]

This will be show the activities of 

  • related to that user

  • employees related to that current user manages

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
Publicaciones relacionadas Respuestas Vistas Actividad
Security groups and record rules Resuelto
security record_rules
Avatar
Avatar
1
nov 24
2353
Add unlink = False for record rule not work
security record_rules
Avatar
0
ago 21
3187
Restrict access by company Resuelto
security record_rules
Avatar
1
jun 19
4887
How to change Record Rules for the My Timesheets, so that only tasks to be shown to user that are assigned to him
record_rules timesheets
Avatar
0
jun 17
3662
How to segregate contact records using record rules
security record_rules permissions
Avatar
Avatar
2
nov 24
2078
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