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

Can't make stock.landed.cost model read-only for Accounting and Inventory groups (Odoo 15)

Abonare

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

Această întrebare a fost marcată
groupaccessaccessrightsodoo15
1 Răspunde
326 Vizualizări
Imagine profil
Uday

I’m really tired of trying to edit the existing access rights for the model stock.landed.cost 

All I want is to make it read-only for these 3 user groups:

  • Accounting / Accountant
  • Inventory / Administrator
  • Accounting / Chief Accountant

What I tried:

I added the following lines in my security/ir.model.access.csv file:

"access_stock_landed_cost_account_manager","stock.landed.cost.account.manager","stock_landed_costs.model_stock_landed_cost","account.group_account_manager",1,0,0,0 "access_stock_landed_cost_account_accountant","stock.landed.cost.account.manager","stock_landed_costs.model_stock_landed_cost","base_accounting_kit.group_account_accountant",1,0,0,0 "access_stock_landed_cost","stock.landed.cost","stock_landed_costs.model_stock_landed_cost","stock.group_stock_manager",1,0,0,0

I tried using both the same names as the existing access rules and also different names, but it still didn’t work.

Users from these groups continue to have full access (create, write, unlink).

I know that access rights can be edited manually via the Odoo UI, but that is not my goal.

I want to:

  1. Keep the existing groups (Accounting / Accountant, Inventory / Administrator, Accounting / Chief Accountant) as read-only.
  2. Create a new user group that has full access (read, write, create, delete) to this model only


What’s the correct way to make the existing groups read-only on this model?

0
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,


In Odoo, access rights are cumulative, meaning if a user belongs to multiple groups, they automatically inherit the highest level of permission from any of those groups. This is why your read-only access rules didn’t work, the users still had full rights inherited from existing rules defined in other modules.


To fix this, you first need to remove the existing ACLs for the stock.landed.cost model. You can do this in your custom module by adding <delete> tags in a security.xml file to delete the default access rules provided by the stock or accounting modules. After deleting the default rules, you can then define new access control entries in your ir.model.access.csv file that grant read-only permissions (1,0,0,0) to the three groups — Accounting / Accountant, Accounting / Chief Accountant, and Inventory / Administrator.


id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

access_stock_landed_cost_readonly_accountant,stock.landed.cost.readonly.accountant,stock_landed_costs.model_stock_landed_cost,account.group_account_manager,1,0,0,0

access_stock_landed_cost_readonly_chief_accountant,stock.landed.cost.readonly.chief_accountant,stock_landed_costs.model_stock_landed_cost,base_accounting_kit.group_account_accountant,1,0,0,0

access_stock_landed_cost_readonly_inventory_admin,stock.landed.cost.readonly.inventory.admin,stock_landed_costs.model_stock_landed_cost,stock.group_stock_manager,1,0,0,0



Next, if you need a specific group with full access to manage landed costs, you can create a new custom group (e.g., “Landed Cost Manager”) and assign it full permissions (1,1,1,1) on the same model.


<record id="group_landed_cost_manager" model="res.groups">

    <field name="name">Landed Cost Manager</field>

    <field name="category_id" ref="base.module_category_inventory"/>

</record>


access_stock_landed_cost_full_access,stock.landed.cost.full.access,stock_landed_costs.model_stock_landed_cost,my_module.group_landed_cost_manager,1,1,1,1


Finally, you should upgrade your module (not just restart the server) so Odoo properly reloads the updated ACLs. This approach ensures your existing groups have read-only access, while your new group retains full control over landed cost records.



If access rights alone don't work, add record rules in your security file:


<!-- Read-only rule for Accountants -->

<record id="stock_landed_cost_readonly_accountant_rule" model="ir.rule">

    <field name="name">Landed Cost - Read Only for Accountants</field>

    <field name="model_id" ref="stock_landed_costs.model_stock_landed_cost"/>

    <field name="domain_force">[(1, '=', 1)]</field>

    <field name="groups" eval="[(4, ref('account.group_accountant'))]"/>

    <field name="perm_read" eval="True"/>

    <field name="perm_write" eval="False"/>

    <field name="perm_create" eval="False"/>

    <field name="perm_unlink" eval="False"/>

</record>


<!-- Repeat for other groups -->

<record id="stock_landed_cost_readonly_account_manager_rule" model="ir.rule">

    <field name="name">Landed Cost - Read Only for Chief Accountants</field>

    <field name="model_id" ref="stock_landed_costs.model_stock_landed_cost"/>

    <field name="domain_force">[(1, '=', 1)]</field>

    <field name="groups" eval="[(4, ref('account.group_account_manager'))]"/>

    <field name="perm_read" eval="True"/>

    <field name="perm_write" eval="False"/>

    <field name="perm_create" eval="False"/>

    <field name="perm_unlink" eval="False"/>

</record>


<record id="stock_landed_cost_readonly_stock_manager_rule" model="ir.rule">

    <field name="name">Landed Cost - Read Only for Stock Managers</field>

    <field name="model_id" ref="stock_landed_costs.model_stock_landed_cost"/>

    <field name="domain_force">[(1, '=', 1)]</field>

    <field name="groups" eval="[(4, ref('stock.group_stock_manager'))]"/>

    <field name="perm_read" eval="True"/>

    <field name="perm_write" eval="False"/>

    <field name="perm_create" eval="False"/>

    <field name="perm_unlink" eval="False"/>

</record>


Hope it helps

2
Imagine profil
Abandonează
Uday
Autor

Thanks, that works!

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
Related Posts Răspunsuri Vizualizări Activitate
Hiding the menu items for user groups Rezolvat
group access
Imagine profil
Imagine profil
1
mai 23
2878
Forbid user group to make any changes in products
access accessrights
Imagine profil
2
mai 19
2540
odoo - access to user manager Rezolvat
group access user_management
Imagine profil
Imagine profil
2
sept. 24
2152
How to prevent user from opening and closing any session in POS?
pos group accessrights
Imagine profil
0
aug. 24
1147
Struggling with ir.model.access.csv Rezolvat
security group access
Imagine profil
Imagine profil
Imagine profil
2
sept. 21
12790
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