Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to add a group to inherited view odoo16

Naroči se

Get notified when there's activity on this post

This question has been flagged
viewsgroupsodoo16features
3 Odgovori
15875 Prikazi
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
Opusti
Avatar
Rama Altayeb
Avtor Best Answer

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
Opusti
Globalist Technology

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

Avatar
AKRAM
Best Answer

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
Opusti
Rama Altayeb
Avtor

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
Avtor

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

Rama Altayeb
Avtor

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
Best Answer

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
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
want to find a tiny View to edit with Odoo frontend via Settings...
views odoo16features
Avatar
Avatar
Avatar
2
avg. 24
5127
User Access in Specific Field
views odoo16features
Avatar
Avatar
Avatar
2
jan. 24
2707
v16: while Upgrading Module it is showing View related Error Solved
views odoo16features
Avatar
Avatar
1
nov. 23
2933
remove groups_id from view Solved
views groups
Avatar
Avatar
1
jul. 19
11494
how to use FIGMA for Odoo to create Forms, Tree and other Views
views odoo16features beautify
Avatar
Avatar
1
dec. 24
6229
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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