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
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • 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
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • 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

How to add a group to inherited view odoo16

S'inscrire

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

Cette question a été signalée
viewsgroupsodoo16features
3 Réponses
15895 Vues
Avatar
Rama Altayeb

I am inheriting a view and I want to add a group to it:

  

        <record id="inherited_view_attendance_tree" model="ir.ui.view&qout;>
           <field name="name">my_inherited_hr_attendance_view</field>
            <field name="model">hr.attendance</field>
            <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
            <field name="groups_id" eval="[(4, ref('hr_attendance.group_hr_attendance_user'))]"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='worked_hours']" position="attributes">
                    <attribute name="invisible">True</attribute>
                </xpath>
            </field>
        </record>








And I am getting an error like this


odoo.tools.convert.ParseError: while parsing /mnt/extra-addons/my_project_name/views/hr_attendance.xml:5
Inherited view cannot have 'Groups' define on the record. Use 'groups' attributes inside the view definition

How to solve this issue?

2
Avatar
Ignorer
Avatar
Rama Altayeb
Auteur Meilleure réponse

I found the answer like this


<record id="inherited_view_attendance_tree" model="ir.ui.view&qout;>           <field name="name">my_inherited_hr_attendance_view</field>
            <field name="model">hr.attendance</field>
            <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='worked_hours']" position="attributes">
                    <t groups="hr_attendance.group_hr_attendance_user">
                        <attribute name="invisible">True</attribute>
                    </t>
                </xpath>
            </field>
        </record>


0
Avatar
Ignorer
Globalist Technology

I don't think this is a proper solution. It's not working as expected.

Avatar
AKRAM
Meilleure réponse

Hello RamaAltayed,

I tested your solution, but the element became hidden for all groups !!
can you help me ?

Below my code:

<record id="inherit_view_quotation_form_pss_group" model="ir.ui.view">


    <field name="name">hide.order.line.for.pss.group</field>


    <field name="model">sale.order</field>


    <field name="inherit_id" ref="sale.view_order_form"/>


    <field name="arch" type="xml">


        <xpath expr="//page[@name='order_lines']" position="attributes">


            <t groups="ns_crm.ns_crm_pss_team">


                <attribute name="invisible">True</attribute>


            </t>


        </xpath>


        <xpath expr="//page[@name='customer_signature']" position="attributes">


            <t groups="ns_crm.ns_crm_pss_team">


                <attribute name="invisible">True</attribute>


            </t>


        </xpath>


    </field>


</record>




1
Avatar
Ignorer
Rama Altayeb
Auteur

Yes of course,
Please share your code

AKRAM

below my code:
<pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'JetBrains Mono',monospace;font-size:9,8pt;"><span style="color:#e8bf6a;">&lt;record </span><span style="color:#bababa;">id</span><span style="color:#6a8759;">=&quot;inherit_view_quotation_form_pss_hide_element&quot; </span><span style="color:#bababa;">model</span><span style="color:#6a8759;">=&quot;ir.ui.view&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;field </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;name&quot;</span><span style="color:#e8bf6a;">&gt;</span>Hide Order line for PSS<span style="color:#e8bf6a;">&lt;/field&gt;
</span><span style="color:#e8bf6a;"> &lt;field </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;model&quot;</span><span style="color:#e8bf6a;">&gt;</span>sale.order<span style="color:#e8bf6a;">&lt;/field&gt;
</span><span style="color:#e8bf6a;"> &lt;field </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;inherit_id&quot; </span><span style="color:#bababa;">ref</span><span style="color:#6a8759;">=&quot;sale.view_order_form&quot;</span><span style="color:#e8bf6a;">/&gt;
</span><span style="color:#e8bf6a;"> &lt;field </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;arch&quot; </span><span style="color:#bababa;">type</span><span style="color:#6a8759;">=&quot;xml&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;xpath </span><span style="color:#bababa;">expr</span><span style="color:#6a8759;">=&quot;//page[@name=&apos;order_lines&apos;]&quot; </span><span style="color:#bababa;">position</span><span style="color:#6a8759;">=&quot;attributes&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;t </span><span style="color:#bababa;">groups</span><span style="color:#6a8759;">=&quot;ns_crm.ns_crm_pss_team&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;attribute </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;invisible&quot;</span><span style="color:#e8bf6a;">&gt;</span>True<span style="color:#e8bf6a;">&lt;/attribute&gt;
</span><span style="color:#e8bf6a;"> &lt;/t&gt;
</span><span style="color:#e8bf6a;"> &lt;/xpath&gt;
</span><span style="color:#e8bf6a;"> &lt;xpath </span><span style="color:#bababa;">expr</span><span style="color:#6a8759;">=&quot;//page[@name=&apos;customer_signature&apos;]&quot; </span><span style="color:#bababa;">position</span><span style="color:#6a8759;">=&quot;attributes&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;t </span><span style="color:#bababa;">groups</span><span style="color:#6a8759;">=&quot;ns_crm.ns_crm_pss_team&quot;</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;"> &lt;attribute </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">=&quot;invisible&quot;</span><span style="color:#e8bf6a;">&gt;</span>True<span style="color:#e8bf6a;">&lt;/attribute&gt;
</span><span style="color:#e8bf6a;"> &lt;/t&gt;
</span><span style="color:#e8bf6a;"> &lt;/xpath&gt;
</span><span style="color:#e8bf6a;"> &lt;/field&gt;
</span><span style="color:#e8bf6a;">&lt;/record&gt;</span></pre>

Rama Altayeb
Auteur

Are you sure of the groups' external id "ns_crm.ns_crm_pss_team"?
I can't find the "ns_crm" module

Rama Altayeb
Auteur

I tested your code but with a different group external id and its working very well on odoo16

Muhammad Yusuf

I have the same issue it's working if I use field like add a new field inside <t but always working for attribute

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

Hi,

You can try like below, in the following code the action_cancel button will replace only for the user with group base.group_no_one

<?xml version="1.0" encoding="utf-8"?>


<odoo>


    <record id="sale_order_inherit_form_view" model="ir.ui.view">


        <field name="name">sale.order.inherit.form.view</field>


        <field name="model">sale.order</field>


        <field name="inherit_id" ref="sale.view_order_form"/>


        <field name="groups_id" eval="[(6,0,[ref('base.group_no_one')])]"/>


        <field name="arch" type="xml">


            <button name="action_cancel" position="replace">


            </button>


        </field>


    </record>


</odoo>


Regards

-6
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é
want to find a tiny View to edit with Odoo frontend via Settings...
views odoo16features
Avatar
Avatar
Avatar
2
août 24
5132
User Access in Specific Field
views odoo16features
Avatar
Avatar
Avatar
2
janv. 24
2711
v16: while Upgrading Module it is showing View related Error Résolu
views odoo16features
Avatar
Avatar
1
nov. 23
2948
remove groups_id from view Résolu
views groups
Avatar
Avatar
1
juil. 19
11500
how to use FIGMA for Odoo to create Forms, Tree and other Views
views odoo16features beautify
Avatar
Avatar
1
déc. 24
6243
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