Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to make a field invisible for certain groups

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
fieldsgroupsvisibility
5 Replies
51542 Rodiniai
Portretas
Shawn Varghese

This question seems to have been asked before, but I couldn't get the answers to work.

I have a field - amount_words. It should be invisible only to one group and visible to all others. This is what I have done so far:

 <record id="view_order_line_tree2" model="ir.ui.view">
    <field name="name">sale.order.line.tree.inherit</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <xpath expr="//page/group" position="after"> <group class="oe_subtotal_amount_footer oe_left"> <field name="amount_words" /> </group> </xpath> </field> </record>

This is to introduce the amount_words field.

Now, to hide it for the service_order group:

 <record id="view_order_line_tree3" model="ir.ui.view">
    <field name="name">sale.order.line.tree.inherit2</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="view_order_line_tree2"/>
    <field name="groups_id" eval="[(6, 0, [ref('custom_sale.group_service_order') ])]"/>
    <field name="arch" type="xml">
	<field name="amount_words" position="attributes">
	    <attribute name="attrs">{'invisible':1}</attribute>
	</field>
    </field>
</record>

But the effect is that it is now invisible for all groups. Does anyone know how to achieve this?



2
Portretas
Atmesti
Portretas
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Add a boolean field to the xml file and make it invisible.

Add the invisible attribute to the amount_words field.

Write a compute function to compute the value of the boolean field according to the user has the group to which the field visibility is to be blocked or not.

XML file:

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


    <field name="name">sale.order.line.tree.inherit</field>


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


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


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


        <xpath expr="//page/group" position="after">


            <group class="oe_subtotal_amount_footer oe_left">


                <field name="flag" invisible="1"/>


                <field name="amount_words"  attrs="{ 'invisible': [('flag', '=', True)] }"/>


            </group>


        </xpath>


    </field>


</record>


Python file:

class SaleOrder(models.Model):
_inherit = 'sale.order'

amount_words = fields.Char()
flag = fields.Boolean(compute='check_group')

def check_group(self):
if self.user_has_groups('custom_sale.group_service_order'):
self.flag = True
else:
self.flag = False

Regards

2
Portretas
Atmesti
Portretas
Kalpana Hemnani
Best Answer


Hello Shawn,

You can use 'groups' for number of groups you want to show this field just like below:

<field name="amount_words" position="attributes">

    <attribute name="groups">other_than_service_order_group_name</attribute>

</field>

After doing this, field will only be seen to groups you have mentioned in group attribute.

Hope this helps!

Thanks,

Kalpana Hemnani

 

2
Portretas
Atmesti
Shawn Varghese
Autorius

Thanks Kalpana, but here I would have to assign the majority of my users to a separate group which seems unnecessary. I have commented in the other post. Please let me know in case you have any other suggestions.

Portretas
Solanki Shamji
Best Answer

Hello,

Please check the this url.

http://pinakinnayi.blogspot.in/2013/06/field-level-security-in-openerp.html

Hope this will help you.

Thanks.

Shamji


0
Portretas
Atmesti
Shawn Varghese
Autorius

Thanks Solanki, but I think the link describes how to display it for a certain group. In my case, there are only very few users who should not see the field, so I created a group for that purpose. The workaround would be to create a separate group, assign everyone else to that group and apply groups to that. But that would be a tedious task and not the ideal way to do it. I think the code snippet that I posted with some tweaks should accomplish the task. Please let me know if you have any other ideas.

Portretas
CARLOS ALBERTO GARCIA BRIZUELA
Best Answer

For me in the same situation works this way. First, create a new group (group_purchase_restrict) in Odoo or your module, and then declare the XML view like this:

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

    <field name="name">purchase.order.form.mods</field>

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

    <field name="inherit_id" ref="purchase.purchase_order_form" />

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

        <xpath expr="//button[@name='purchase_confirm'][1]" position="attributes">

            <attribute name="groups">purchase.group_purchase_user,purchase.group_purchase_manager</attribute>

        </xpath>

    </field>

</record>


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

    <field name="name">purchase.order.form.mods.restrict</field>

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

    <field name="inherit_id" ref="purchase.purchase_order_form" />

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

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

        <xpath expr="//button[@name='purchase_confirm'][1]" position="attributes">

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

        </xpath>

    </field>

</record>

This way hide the button only for the users belonging to the new group (group_purchase_restrict).

 I hope it helps

0
Portretas
Atmesti
Portretas
Farid Ghanchi
Best Answer

Dear Shawn,

You can create a new wizard, And in this wizard you can choose a User/Customer (Specific User) and on this User/Customer give a access to this new field is visible or invisible. 

Thanks.

Farid Ghanchi

-1
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
How can I append to the existing groups for a field in a view?
fields groups
Portretas
Portretas
1
geg. 23
5001
Get all the users that belong to a group Odoo15 Solved
fields groups v15
Portretas
Portretas
Portretas
2
kov. 24
6625
Make Field Read Only for specific Group Solved
security fields groups
Portretas
Portretas
1
spal. 25
10840
How to set field value based on user group?
security fields groups
Portretas
Portretas
2
saus. 16
5077
make fields as read only based on groups
fields readonly groups
Portretas
Portretas
2
rugs. 15
5121
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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