Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

How to make users only able to see their own Contacts and CRM?

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
contactsfiltering
3 Trả lời
20299 Lượt xem
Ảnh đại diện
Bayu Bramantya

Hi, i need to make each user to only be able to see their own data. But currently all users can see contacts from other users and CRM from other users. 

for example there are User A and User B. User A will only be able to see contacts and CRM from user A. User B will only be able to see contacts and CRM from user B.

How to make users only able to see their own Contacts and CRM? thank you

0
Ảnh đại diện
Huỷ bỏ
Bayu Bramantya
Tác giả

@Gando Loudo thank you, that works but it also applies to administrator. 

any idea how to make it only applies to certain users (or type of users)?

Bayu Bramantya
Tác giả

ive tried added "group" to the record rule for contact. but it doesnt work for contacts. there's no "contacts" "application"

Bayu Bramantya
Tác giả

my bad. turns out @gando loudo's script only work for admin. while non admin got this error

Due to security restrictions, you are not allowed to access 'User' (res.users) records.

Records: test2 (id=7)
User: test2 (id=7)

This restriction is due to the following rules:

Contact your administrator to request access if necessary.

Bhavin Patel

To restrict users to only see their own contacts and CRM records, you can use record rules in Odoo. Record rules allow you to restrict access to specific records based on certain conditions, such as the owner of the record.

Here's an example of how to create a record rule that restricts access to Contacts and CRM records based on the owner:

Go to Settings > Technical > Security > Record Rules.
Create a new record rule for the model you want to restrict access to (e.g. Contacts or CRM).
Set the Domain to ['|', ('user_id', '=', user.id), ('user_id', '=', False)]. This domain will restrict access to records where the user is the owner or the owner is not set.
Set the Apply for Read field to Yes to apply this rule when reading records.
Set the Apply for Write field to Yes to apply this rule when writing records.
Set the Groups field to the appropriate group(s) that should have this restriction applied to them.

With this record rule in place, users will only be able to see Contacts and CRM records that they own, or records where the owner is not set. Note that you will need to adjust the domain and group settings to fit your specific requirements.

Regarding the issue you mentioned with the script only working for administrators, you can modify the script to check if the current user has permission to read the res.users model before running the search. Here's an example:

python

from odoo import api, fields, models

class ResPartner(models.Model):
_inherit = 'res.partner'

@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
if self.env.user.has_group('base.group_user'):
# Only apply restriction for non-admin users
user_id = self.env.user.id
args += [('user_id', '=', user_id)]
return super().search(args, offset, limit, order, count)

In this modified code snippet, the has_group() method is used to check if the current user belongs to the base.group_user group, which includes all non-admin users. If the user has this group, the search will be restricted to records where the user is the owner. If the user does not have this group (i.e. they are an administrator), the search will return all records.

Ing. Ang3l Barrera

At the moment I have the same problem.
Thank you so much for you post, your post really help!!!

Bhavin Patel is a mastert!!!!

Ảnh đại diện
Cybrosys Techno Solutions Pvt.Ltd
Câu trả lời hay nhất

Hi,

Users are only able to see their Contacts by using the Record rule:

<record id="crm_record_rule_user" model="ir.rule">
<field name="name">Record Rule for crm user</field>
<field ref="model_[your_model_name]" name="model_id"/>
<field name="domain_force">[('related_partner_id', '=', user.id)] style="color:#e8bf6a;"></field>
<field name="groups" eval="[(4, ref('module_name.crm_user'))]"/>
</record>

Here the corresponding partner field refers to the user, so we can connect the user id with this field in the model. You can replace the 'related_partner' field with the res.partner field of this model.

Refer to this link:

https://www.cybrosys.com/odoo/odoo-books/odoo-16-development/security/record-rules/

Regards

1
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Sandeep Sonare
Câu trả lời hay nhất

To restrict users to only see their own Contacts and CRM, create Record Rules for Contacts (res.partner) and CRM (crm.lead) using the domain `('user_id', '=', user.id)`. Apply these rules under Settings > Technical > Security > Record Rules for the respective models.

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Bhavin Patel
Câu trả lời hay nhất

To make users only able to see their own contacts and CRM, you can apply record rules in Odoo. Here are the steps to create record rules for Contacts and CRM modules:

  1. Go to the "Settings" menu in Odoo and click on "Technical" to access the technical settings.

  2. Under "Security," click on "Record Rules" to view the list of all the record rules in Odoo.

  3. Click on "Create" to create a new record rule.

  4. In the record rule form, specify the name of the record rule, the model for which the rule will apply (e.g., "Contacts" or "CRM"), and the domain filter that specifies which records should be visible to the user.

For example, to make User A only able to see contacts and CRM from user A, you can create a domain filter like this:

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

Where user_id is the field that identifies the user who owns the record and user.id is the ID of the current user.

  1. Specify the access rights for the record rule, such as read, write, and delete. In this case, you would want to allow read access only.

  2. Click "Save" to save the record rule.

  3. Repeat steps 3-6 for each model (Contacts, CRM) that you want to restrict access to.

Once you have created the record rules, each user will only be able to see their own contacts and CRM records. If a user tries to access records owned by another user, they will receive an access error message.

0
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
importing contacts. Getting blocking error: Contacts require a name at multiple rows
contacts
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 10 25
802
Blocking Errors
contacts
Ảnh đại diện
Ảnh đại diện
1
thg 10 25
681
O18 EE: Completely unknown email addresses in the contacts?
contacts
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 10 25
851
Add contacts to the seller field and not users
contacts
Ảnh đại diện
Ảnh đại diện
1
thg 5 25
2370
Odoo 12 Online: How to force - and lock custom filter in contacts, disable the remove function Đã xử lý
filtering
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 3 25
6782
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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