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

My profile gives access error for employee fields

Suscribirse

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

Se marcó esta pregunta
employeeAccessError13.0
3 Respuestas
11228 Vistas
Avatar
Sprintit Oy / Roy Nurmi

In v13, if user is related to an emplyee, and I g to My profile, gives the following error. I.e, user needs to be HR/Offices to be able to access "My profile", which is certainly wrong.

These fields are on hr.employee model, so basically I see the reason for the restriction, but in this use case this does not work at all.

The requested operation can not be completed due to security restrictions. Document type: Users (res.users) Operation: read User: 9 Fields: - address_home_id (allowed for groups 'Employees / Officer') ...

0
Avatar
Descartar
Minh Hong

Hi, May I know if this issue can fix by any solutions?

Robin

I met the same issue, who can fix it?

Bayside Aviation

This helped alot..

Avatar
Livia Filippi
Mejor respuesta

Hello.

We recently encountered the same error on one of our production databases. After a little bit of analysis, we realized we were adding a field on the res.users model and added this field on the inherited form view base.view_users_form_simple_modif in a custom module. 

What happens is that Odoo hr module introduces a new view on the res.users model to allow any user to visualize any private information on the employee connected to their user from the “My profile” view and this new hr view res_users_view_form_simple_modif inherits in mode primary from the base.view_users_form_simple_modif. Inheriting in mode primary allows the base view to be extended from other modules but still add the same edits on the hr extended view.

When the hr module is installed the base view is automatically overridden by the hr view, res_users_view_form_simple_modif and looks for which fields are accessible on the res.users model. Thus, res.users must override the __init__() method to add the field to the list of readable and writable fields in res.users. How the override of __init__ was done was looked up in the module mail (where it is done way more simply than how it is done in the hr module).

I  suggest having a look at these commits on github relative to the hr module to better understand why it works like that: 

  • https://github.com/odoo/odoo/commit/d77ce4c2a92c1da48150e4e84b714dd93f64847d
  • https://github.com/odoo/odoo/commit/c9ca3761464413327d2beb697553a3ccd7eef4d1

So our solution was:


res_users.py  
new_field = fields.Boolean(string="Our New Field", default=False)
def __init__(self, pool, cr):
# Override of __init__ to add access rights on new_field.             
# Access rights are disabled by default, but allowed            
# on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.  
init_res = super(Users, self).__init__(pool, cr)        
# duplicate list to avoid modifying the original reference        
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)        
type(self).SELF_WRITEABLE_FIELDS.extend(['new_field'])        
# duplicate list to avoid modifying the original reference        
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)        
type(self).SELF_READABLE_FIELDS.extend(['new_field'])        
return init_res

res_users.xml
inherit on view ref="base.view_users_form_simple_modif" (for my profile)
and on view ref="base.view_users_form" (for general settings > users)


2
Avatar
Descartar
Bayside Aviation

This helped, however I'm still having issues with saving of the data, even though its been added to writeable_fields...strange

Livia Filippi

Hello @Cameron P, are you still encountering some error? Or it just doesn't save at all?

luna_22

I'm so grateful, it helped a lot. Thank you so much

Asma Ben Brahem

Hello, What can I do in case of adding two fields ?
I tried adding my two fields to the extend method like this
profession = fields.Char(String="Profession")
titre = fields.Char(string="Titre")
and in the init method we have:
init_res = super(user, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
type(self).SELF_WRITEABLE_FIELDS.extend(['profession', 'titre'])
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
type(self).SELF_READABLE_FIELDS.extend(['profession', 'titre'])

and of course added the two new fields in the specified inherited views, your method works pretty fine for one field, but when I tried adding one second field, I get the access right error, I would be grateful if you can help me with this

Livia Filippi

Hello, @Asma Ben Brahem as far as I can tell it seems you defined everything I expected, except maybe the return of the function (unless you just didn't copy it to your comment). Have you tried checking out the original code in the mail module here and make sure everything reflects how odoo expects it? https://github.com/odoo/odoo/blob/deaf27a75b0b123636066679dd14ef6b62541091/addons/mail/models/res_users.py#L68

Michael Jurke

Thank you! We indeed added a field to users model and installed the hr module. And could solve the conflict with the instructions above.

In Odoo 16, I had to change __init__(self, pool, cr) to __init__(self, *args) and super().__init__(*args) repectively. There are more arguments now.

Avatar
Raúl
Mejor respuesta

Did you find a solution? I have the same problem and I can't resolve it :S

0
Avatar
Descartar
Avatar
Muhammed Fasil
Mejor respuesta


Did you tried after checked the 'Employee Edition'?
Settings --> Employee Tab


0
Avatar
Descartar
¿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
Access error when accesing "My profile", doing that requires "officer" access
hr employee permissions AccessError
Avatar
Avatar
1
sept 22
4030
hr_employee_public.timesheet_manager_id does not exist
employee
Avatar
Avatar
1
ago 25
4617
Recurring training
employee
Avatar
Avatar
1
oct 24
8002
[odoo 13]Discuss template
13.0
Avatar
0
oct 24
2127
Employee Bank Account Number Resuelto
employee
Avatar
Avatar
Avatar
2
jul 24
3020
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