Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Restrict Records in Timesheet Activities to User and Employees that are Managed by the User

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
securityormactivityrecord_rulestimesheets
3 Odpowiedzi
11699 Widoki
Awatar
Damian Bere

Context

We are using Odoo 9 Contracts Management functionality and need to record timesheets with tasks.  As this is not possible in the default entry form (see this post: https://www.odoo.com/forum/help-1/question/record-activities-time-against-project-tasks-in-odoo-9-timesheets-92869 )  we need to use the Activities view, which shows entries from the Analytic Account Line data model.


Problem

The current Activities view shows all records (all activities from all users for all analytic accounts).  

We want to show:

  • The entries related to that user

  • The entries related to employees that user manages, and

  • The entries related to Analytic Accounts / Projects Managed by the User

  • All entries when user is part of a specific Permissions Group (e.g. Human Resources / Manager, etc)


So Far...

  • We are using the record rules to filter what the user can see and are building this up step by step

  • We can successfully filter entries related to the user:  [('user_id','=',user.id)]

  • We tried to also filter where the user was the manager, but failed with many variations of the following:  ['|',('user_id','=',user.id),('user_id.manager_id','=',user.id)]   and  ['|',('user_id','=',user.id),('user_id.employee_ids.parent_id','=',user.id)]  and ['|',('user_id','=',user.id),('user_id.employee_ids.parent_id','child_of',user.id)]  etc etc  

We get exceptions like:  "user_id" not found in "hr.employee" table when using the child_of method, other times it will say no such field/leaf, and yet other times it will not report an error but wont show the expected records either.

Clearly we are just not understanding how to relate to the ORM model, but the documentation we've found doesn't seem to help a great deal (maybe we've missed something though).


Any help or guidance appreciated!


1
Awatar
Odrzuć
Awatar
Baiju KS
Najlepsza odpowiedź

Hi,

Everything is correct except manager rule :-

It should be ['|',('parent_id.user_id', '=', user.id),('user_id', '=', user.id)]

the left part cannot be 'user_id.manager_id' or 'user_id.employee_ids.parent_id'  because here user_id is many2one field to res.users and there is no field like .employee_ids and .manager_id in res.users that’s why it throws error.

For selecting manager's user id we have to select manager field and from there the user_id (here manger field is parent_id "many2one field refer to hr.employee itself") :-  'parent_id.user_id' .


Hope this helps.




2
Awatar
Odrzuć
Damian Bere
Autor

Thanks for the reply Baiju - it sounds sensible. Unfortunately I can't check this on our system at the moment due to other things going on, but will confirm when I do.

Awatar
oyunsuren
Najlepsza odpowiedź

Hello.

It is late answer. But maybe helps to some others.

I added following domain filter on Activities action.

['&',('is_timesheet', '=', True),'|',('user_id.employee_ids.parent_id.user_id', '=', uid),('user_id', '=', uid)]

This will be show the activities of 

  • related to that user

  • employees related to that current user manages

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Security groups and record rules Rozwiązane
security record_rules
Awatar
Awatar
1
lis 24
2349
Add unlink = False for record rule not work
security record_rules
Awatar
0
sie 21
3184
Restrict access by company Rozwiązane
security record_rules
Awatar
1
cze 19
4887
How to change Record Rules for the My Timesheets, so that only tasks to be shown to user that are assigned to him
record_rules timesheets
Awatar
0
cze 17
3660
How to segregate contact records using record rules
security record_rules permissions
Awatar
Awatar
2
lis 24
2077
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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