Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Record Rules related to current user

Naroči se

Get notified when there's activity on this post

This question has been flagged
record_rulesaccess_rulesaccessrights
1 Odgovori
8403 Prikazi
Avatar
Rashid Shahid

I am trying to achieve something similar to the record rule used in "User: Own Documents Only Group" where a user in said group will only be able to view their sales order only.

The rule is as follows: 

['|',('user_id','=',user.id),('user_id','=',False)]
In my res.user model I have a new field called "Default Warehouse (warehouse_id)" What I want is for any user to able to view all sales order with "warehouse_id" on the sales order same as the 'warehouse_id' field set for the current user. 

0
Avatar
Opusti
Avatar
Pranjal Gami
Best Answer

Hey Rashid,

You need to create a new record rule. Below will filter out records having warehouse_id set in Sales order.

Object : Sale Order Domain : [ ('warehouse_id', '=' , user.your_custom_field.id) ]

If you wish to see where warehouse_id is null then use the below domain.
Object : Sale Order Domain : [ '|' , ( 'warehouse_id' , '=' , user.your_custom_field.id ), ( 'warehouse_id' , '=' , False)]

Regards,
Pranjal G.

2
Avatar
Opusti
Rashid Shahid
Avtor

@Pranjal Gami When I try this I get the following error

Odoo Server Error

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch

result = request.dispatch()

File "/home/odoo/src/odoo/odoo/http.py", line 683, in dispatch

result = self._call_function(**self.params)

File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper

return f(dbname, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/http.py", line 347, in checked_call

result = self.endpoint(*a, **kw)

File "/home/odoo/src/odoo/odoo/http.py", line 912, in __call__

return self.method(*args, **kw)

File "/home/odoo/src/odoo/odoo/http.py", line 531, in response_wrap

response = f(*args, **kw)

File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1335, in search_read

return self.do_search_read(model, fields, offset, limit, domain, sort)

File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1354, in do_search_read

return Model.web_search_read(domain, fields, offset=offset, limit=limit, order=sort)

File "/home/odoo/src/odoo/addons/web/models/models.py", line 53, in web_search_read

records = self.search_read(domain, fields, offset=offset, limit=limit, order=order)

File "/home/odoo/src/odoo/odoo/models.py", line 4814, in search_read

records = self.search(domain or [], offset=offset, limit=limit, order=order)

File "/home/odoo/src/odoo/odoo/models.py", line 1698, in search

res = self._search(args, offset=offset, limit=limit, order=order, count=count)

File "/home/odoo/src/odoo/odoo/models.py", line 4487, in _search

self._apply_ir_rules(query, 'read')

File "/home/odoo/src/odoo/odoo/models.py", line 4268, in _apply_ir_rules

expression.expression(domain, self.sudo(), self._table, query)

File "/home/odoo/src/odoo/odoo/osv/expression.py", line 438, in __init__

self.parse()

File "/home/odoo/src/odoo/odoo/osv/expression.py", line 859, in parse

expr, params = self.__leaf_to_sql(leaf, model, alias)

File "/home/odoo/src/odoo/odoo/osv/expression.py", line 938, in __leaf_to_sql

assert not isinstance(right, BaseModel), \

Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/http.py", line 639, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/home/odoo/src/odoo/odoo/http.py", line 315, in _handle_exception

raise exception.with_traceback(None) from new_cause

AssertionError: Invalid value stock.warehouse(3,) in domain term ('warehouse_id', '=', stock.warehouse(3,))

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Can you restrict User access to Bills / Payments v16
record_rules access_rules
Avatar
Avatar
Avatar
2
jan. 24
3403
what is different access right and record rules in odoo online Solved
record_rules access_rules odooonline
Avatar
Avatar
Avatar
2
sep. 25
4647
Remove access right error message
contact record_rules accessrights
Avatar
Avatar
Avatar
2
jun. 25
5527
Time Off - Employees must only see overview of their department
record_rules accessrights Timeoff
Avatar
Avatar
2
jan. 25
3049
How to hide "validate" button in transfer using access rule and group in nV17? Solved
inventory access_rules accessrights
Avatar
Avatar
2
maj 24
2712
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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