Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • 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 Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and 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
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Record Rules related to current user

Odoberať

Get notified when there's activity on this post

This question has been flagged
record_rulesaccess_rulesaccessrights
1 Odpoveď
8382 Zobrazenia
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
Zrušiť
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
Zrušiť
Rashid Shahid
Autor

@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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Can you restrict User access to Bills / Payments v16
record_rules access_rules
Avatar
Avatar
Avatar
2
jan 24
3375
what is different access right and record rules in odoo online Solved
record_rules access_rules odooonline
Avatar
Avatar
Avatar
2
sep 25
4618
Remove access right error message
contact record_rules accessrights
Avatar
Avatar
Avatar
2
jún 25
5488
Time Off - Employees must only see overview of their department
record_rules accessrights Timeoff
Avatar
Avatar
2
jan 25
3031
How to hide "validate" button in transfer using access rule and group in nV17? Solved
inventory access_rules accessrights
Avatar
Avatar
2
máj 24
2696
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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