Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivouspalvelut
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Kurssit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

My profile gives access error for employee fields

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
employeeAccessError13.0
3 Vastaukset
11225 Näkymät
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
Hylkää
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
Paras vastaus

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
Hylkää
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
Paras vastaus

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

0
Avatar
Hylkää
Avatar
Muhammed Fasil
Paras vastaus


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


0
Avatar
Hylkää
Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
Access error when accesing "My profile", doing that requires "officer" access
hr employee permissions AccessError
Avatar
Avatar
1
syysk. 22
4030
hr_employee_public.timesheet_manager_id does not exist
employee
Avatar
Avatar
1
elok. 25
4617
Recurring training
employee
Avatar
Avatar
1
lokak. 24
8002
[odoo 13]Discuss template
13.0
Avatar
0
lokak. 24
2124
Employee Bank Account Number Ratkaistu
employee
Avatar
Avatar
Avatar
2
heinäk. 24
3019
Yhteisö
  • Kurssit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Brändiominaisuudet
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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