Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to show or enable the Edit button only on records with write access rights?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
2 Răspunsuri
8145 Vizualizări
Imagine profil
Alessandro Strazzari

An Access rights row gives write access on a model (res_partner for instance), then the edit button appears on all records and I can edit and save any res_partner records.

Then I add a record rule that restricts write access to some records only. The rule works because when I try to save other records the "The requested operation cannot be completed due to security restrictions" error appears, but the useless and misleading Edit button still appears on all res_partner records.

Why? How to show or enable the Edit button only on records with write access rights?

Thanks

0
Imagine profil
Abandonează
Imagine profil
Bharat Parmar (bhp)
Cel mai bun răspuns

I don't know what you written in ir.model.access.csv file. but, i think you need to set access rights like this,

id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
course_administrator,course manager,model_security_model_model1,group_manager,1,1,1,1
course_create_only_users,course all,model_security_model_model1,,1,0,1,1

and don't forget to put administrator users in group_manager.


2
Imagine profil
Abandonează
Bharat Parmar (bhp)

inherit your view to hide the edit button

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

<field name="name">view.form.remove.edit</field>

<field name="model">module_name</field>

<field name="inherit_id" ref="module_name.your_parent_view"/>

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

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

<xpath expr="//form" position="attributes">

<attribute name="edit">false</attribute>

</xpath>

</field>

</record>

Imagine profil
Alessandro Strazzari
Autor Cel mai bun răspuns

Hi, thanks for your aswer.

I think you are suggesting to define a global ir.model.access row "course_create_only_users" without write permission on "course" model, so by default no user can edit courses.

Than a group_manager's ir.model.access row "course_administrator" with all RWCD rights, so the users into the group_manager can edit courses.

That is right, but doesn't apply to my question.

My problem is that I can't define the W right based on group. I need a record rule that restrict the W access based on single record. For instance suppose that the users into the group_manager, ie the teachers, can edit its own courses only, so I need to define a record rule on model course like "[('teacher_id', '=', user.id)].

The rule blocks the Write operation if the current user is not the teacher_id of the course, but in the detail view of the course the user can see the edit button and he can click on it and only after Save action it will appears the "The requested operation cannot be completed due to security restrictions" error.

That is not a good ux!

0
Imagine profil
Abandonează
Alessandro Strazzari
Autor

@Bharat Parmar (bhp)

The solution you suggest of "inherit your view to hide the edit button" is still based on groups visibility. I need some way to disable or hide the edit button if the current user is not the owner of the current record, ie if 'teacher_id', '!=', user.id

Alessandro Strazzari
Autor

I found https://github.com/OCA/web/tree/9.0/web_access_rule_buttons that is more or less what I need

Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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