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

Showing only users that belong to a specific group

Odoberať

Get notified when there's activity on this post

This question has been flagged
filtermany2oneres.partnergroups
1 Odpoveď
10361 Zobrazenia
Avatar
Timo Talvitie, Vizucom Oy

I have a form with a many2one dropdown field for selecting a user. What would be the best way to have the dropdown list of the field show only users that belong to a specific group, for example Sales Managers?

1
Avatar
Zrušiť
Avatar
Ankit H Gandhi(AHG)
Best Answer

Dear Timo Talvitie,

 try this code may be used for you.

<field name="many2one_field" groups="base.group_sale_manager"/>

or 

You should create security file and assign that group in many2one field.

If you dont know how to create security file then follow below step and hope you will get answer


  1. You have to create ir.model.access.csv in your module, I suggest you to create a security folder and put security related file there

  2. Like security/ir.model.access.csv and security/given_any_name_security.xml

  3. Change in openerp.py file like 'security/given_any_name_security.xml, 'security/ir.model.access.csv'

  4. Inside xml file you sholud create group like


    1. <?xml version="1.0" ?>

      <openerp>

      <data noupdate="1">

      <record model="ir.module.category" id="module_school_category">

      <field name="name">School</field>

      <field name="description">School</field>

      <field name="sequence">16</field>

      </record>

      <record id="group_school_user" model="res.groups">

      <field name="name">User</field>

      <field name="category_id" ref="module_school_category" />

      </record>

      <record id="group_school_manager" model="res.groups">

      <field name="name">Manager</field>

      <field name="implied_ids" eval="[(4, ref('group_school_user'))]" />

      <field name="category_id" ref="module_school_category" />

      <field name="users" eval="[(4, ref('base.user_root'))]" />

      </record>

      </data>

      </openerp>

  5. Inside csv file you should give the permission like

    1. id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

      access_student_student_manager,student.student,model_student_student,group_school_manager,1,1,1,1

      access_student_student_user,student.student,model_student_student,group_school_user,1,1,0,0

      access_hobby_hobby_manager,hobby.hobby,model_hobby_hobby,group_school_user,1,1,1,1

      access_hobby_hobby_user,hobby.hobby,model_hobby_hobby,group_school_user,1,1,0,0

  6. Now in your view file to add group in field like

    <field name="many2one_field" groups="module_name.group_id"/>

    here groups define the value of module_name.group_id that means

    group_id: group id which is define in security xml file

    Example:

    <field name="hobby_id" groups="school_management.group_school_manager"/>

    Finally update the module

    Hope this code is usefully for you.

    Thanks & Regards

    Ankit H Gandhi


1
Avatar
Zrušiť
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
fields_view_get Function
res.partner groups
Avatar
0
aug 24
1225
how to filter many2one field based on a select from another table
filter many2one
Avatar
Avatar
Avatar
2
apr 21
12049
Many2one security on link.
many2one res.partner
Avatar
0
sep 17
3435
How to filter a data/field base on a many2one?
filter many2one
Avatar
Avatar
2
júl 15
5534
How to add custom module search to "Advanced Search" in existing Module?
filter res.partner
Avatar
0
mar 15
6369
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