Getting ready

We will extend on the library example from the my_library add-on module in Chapter 4, Creating Odoo Add-On Modules.

Add a manager_remarks field to the library.book model. We only want 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')

Add the manager_remarks field in the <form> of the view/library_book.xml file to access this field from the user interface:

 <field name="manager_remarks"/>

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

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
acl_book_user,library.book_default,model_library_book,base.group_user,1,1,0,0
acl_book_librarian,library.book_librarian,model_library_book,group_librarian,1,1,1,1
..................Content has been hidden....................

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