Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Showing only users that belong to a specific group

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
filtermany2oneres.partnergroups
1 Répondre
10354 Vues
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
Ignorer
Avatar
Ankit H Gandhi(AHG)
Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
fields_view_get Function
res.partner groups
Avatar
0
août 24
1224
how to filter many2one field based on a select from another table
filter many2one
Avatar
Avatar
Avatar
2
avr. 21
12044
Many2one security on link.
many2one res.partner
Avatar
0
sept. 17
3432
How to filter a data/field base on a many2one?
filter many2one
Avatar
Avatar
2
juil. 15
5530
How to add custom module search to "Advanced Search" in existing Module?
filter res.partner
Avatar
0
mars 15
6369
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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