Skip to Content
Odoo Development Cookbook
book

Odoo Development Cookbook

by Holger Brunn, Alexandre Fayolle, Daniel Reis
April 2016
Beginner to intermediate content levelBeginner to intermediate
400 pages
9h 16m
English
Packt Publishing
Content preview from Odoo Development Cookbook

Limit access to fields in models

In some cases we may need more fine grained access control and to limit the access to specific fields in a model.

It is possible for a field to be accessible only by specific security groups, using the groups attribute. We will show how to add to the Library Books model a field with limited access.

How to do it...

To add a field with access limited to specific security groups, perform the following steps:

  1. Edit the model file to add the field:
    private_notes = fields.Text(groups='base.group_system')
  2. Edit the view in the XML file to add the field:
    <field name="private_notes" />

That's it. Now upgrade the addon module for the changes in the model to take place. If you sign in with a user with no system configuration access, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Odoo Development Cookbook - Fifth Edition

Odoo Development Cookbook - Fifth Edition

Husen Daudi, Jay Vora, Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
Odoo 14 Development Cookbook - Fourth Edition

Odoo 14 Development Cookbook - Fourth Edition

Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
Odoo 12 Development Cookbook - Third Edition

Odoo 12 Development Cookbook - Third Edition

Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis

Publisher Resources

ISBN: 9781785883644Supplemental Content