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č

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
groupaccessaccessrightsodoo15
1 Odgovori
281 Prikazi
Avatar
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
Avatar
Opusti
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

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
Avatar
Opusti
Uday
Avtor

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!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Hiding the menu items for user groups Solved
group access
Avatar
Avatar
1
maj 23
2812
Forbid user group to make any changes in products
access accessrights
Avatar
2
maj 19
2481
odoo - access to user manager Solved
group access user_management
Avatar
Avatar
2
sep. 24
2093
How to prevent user from opening and closing any session in POS?
pos group accessrights
Avatar
0
avg. 24
1116
Struggling with ir.model.access.csv Solved
security group access
Avatar
Avatar
Avatar
2
sep. 21
12625
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