Getting ready

We will extend on the library example from the my_module addon module in Chapter 4, Creating Odoo addon Modules.

You will also need the security groups defined in the Creating security Groups and assigning them to Users recipe and the access rights defined in the Adding security access to models recipe from Chapter 11, Access Security.

Modify the security/ir.model.access.csv file to give write access to library users to books:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 
access_library_book_user,library.book.user,model_library_book,base.group_user,1,1,0,0 
access_library_book_admin,library.book.admin,model_library_book,base.group_system,1,0,0,0 

Add a manager_remarks field to the library.book model. We want only members of the Library Managers group to be able to write to that field:

from odoo import models, api, exceptions
class LibraryBook(models.Model):
_name = 'library.book'
manager_remarks = fields.Text('Manager Remarks')
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.195.97