Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

ODOO15 How to display own contacts only.

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
5 Besvarelser
4757 Visninger
Avatar
Ignatius Cronjé

Hi all,


I would like some guidance regarding the configuration to allow internal users to see only the contacts for which they are assigned as Salesman.


I have added a record rule: "User can update own contacts" with the domain filter [('user_id', '=', user.id)]  with access rights for Read, Write, Create and Delete on the Contacts model. The record rule is assigned to the group Sales / User: Own Documents Only


According to https://www.odoo.com/forum/help-1/restrict-users-to-see-only-his-own-contacts-155427 the res.partner.rule.private.employee rule can be removed.

Now, removing this rule does help, but with the rule removed, the user can not login. Trying to login with the rule disabled, results in an access error:


Does anyone have suggestions on how to resolve this?


Regards


Ignatius

0
Avatar
Kassér
Avatar
Sing Wang Ho
Bedste svar

I got it to work in Odoo15.  Let's clarify some fields first in the context.

user_id is an optional field in the partner model for assigning a Sales Person.  This field is mapped to a User's ID not Contact's ID.

id is the Contact's ID

user.id is the current User's ID

user.partner_id.id is current user's Contact's ID.


So if you want an internal user to only see their contact, the access rights should be:

'id', '=', user.partner_id.id

This adds the user itself and will allow him to login.

Next, you want to allow this user to view any contact is is assigned to, so add:

'user_id','=',user.id

Finally, I would also add the "OdooBot" contact...

'id', '=', 2


So the record rule should be:

['|','|',

('id', '=', 2),

('id','=',user.partner_id.id),

('user_id','=',user.id)]

0
Avatar
Kassér
Avatar
Adithya
Bedste svar

This issue occurs because res.partner.rule.private.employee record rule is ['|', ('type', '!=', 'private'), ('type', '=', False)] is assigned to the group "Internal Users" which is applicable to all the users created as internal type. 


One way to override this is, you can create a new group say "xyz" and give the res. Partner. Rule. Private. Employee record rule to this group and remove the record rule for "internal user" group Assign this xyz group to admin and the users for whom all contacts are to be visible. Then create further record rules and groups to users for whom the domain filter has to be applied as per requirement of that particular user without giving them xyz group access. 

0
Avatar
Kassér
Avatar
Ignatius Cronjé
Forfatter Bedste svar

Hi Alouna.

I have tried the record rule [('user_id', '=', user.id)]  and assigned the group as suggested. The behaviour does change according to the requirement, but the authentication issue remains.

It seems like there are conflicting requirements on the Contact model from this perspective.

0
Avatar
Kassér
alouna ahmad

could you provide me with all record rules you have applied so far?
So, i can better analyze the solution for this issue.

Ignatius Cronjé
Forfatter

Hi,

Rules applied / changed as follows:

Disable default res.partner.rule.private.employee

Add rule for All Contacts [(1, '=', 1)] and assign groups Administrator / Access Rights; Purchase / Administrator; Sales / Administrator; Sales / User: All Documents to it with Read, Write, Create, Delete access on Contact model.

Add Rule ['|', '|', ('create_uid', '=', user.partner_id.id), ('user_id', '=', user.partner_id.id), ('user_id', '=', user.id)] and add goups Technical / Contacts Edit Own; Sales / User: Own Documents only with Read, Write, Create, Deleta access rights on Contact model.

Thanks in advance.

Avatar
MUHAMMAD Imran
Bedste svar

For reference, the default res.partner.rule.private.employee record rule is ['|', ('type', '!=', 'private'), ('type', '=', False)] inactive it or inherit it. Then replace. ['|', ('type', '!=', 'private'), ('type', '=', False)]  with [('user_id', '=', user.id)] 

0
Avatar
Kassér
Ignatius Cronjé
Forfatter

Thank you for teh response.

Through inheritence of res.partner.rule.private.employee have no affect. Implementation of the rule as you suggest changes the behaviour as long as the user is authenticated when the change is made.

As soon as the user logs out, the 403-error is displayd and the authentication fails.

When the default res.partner.rule.private.employee is assigned for Read only, the authentication works, but, the user can then still see all contacts. He can, however, only change the contacts for which he is the Sale Peron which is partly the correct behaviour we require.

Avatar
alouna ahmad
Bedste svar

Hello,

you can try this way:

  1. Assign Salesperson on Contact Form.
  2. Create the following record rule on Contact (res.partner) object.
['|', '|', ('create_uid', '=', user.partner_id.id), ('user_id', '=', user.partner_id.id), ('user_id', '=', user.id)]

and apply it for read, write, create, delete.

the result would be: when salesperson open Contacts he will only see contacts which has been assigned to him, also when he creates a sale order the system will fetch only those contacts with his name as a salesperson.

Hope this will help.

0
Avatar
Kassér
Ignatius Cronjé
Forfatter

Thank you, Alouna.

The filter works fine and is in many regards a better solution than the one I implemented.

The outcome only works if I disable the default res.partner.rule.private.employee rule which is similar to the behaviour I saw with my previous filter.

Now, with the new filter and the disabled filter both in place, the user can not authenticate to the ODOO database as per the screenshot provided above.

REgards

Ignatius Cronjé
Forfatter

To clarify my previous response a bit more, just the following:

When I enable the default res.partner.rule.private.employee rule, hte user can authenticate, but then he can also read all contacts when he opens Contacts and while creating sales orders.

For reference, the default res.partner.rule.private.employee record rule is ['|', ('type', '!=', 'private'), ('type', '=', False)]

It seems like the authentication engine uses the Contacts model to authenticate users and when the read access is removed, the user is unable to login to the website.

Maybe there is a more complex solution to this problem.

Regards

alouna ahmad

then just try to use this record:
[('user_id', '=', user.id)]
Hope it will help!

alouna ahmad

and assign a group under record rule:
Sales / User: Own Documents Only

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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