To prevent users who are not members of the Librarian group from modifying the value of manager_remarks, you need to perform the following steps:
- Extend the create() method, as follows:
@api.model def create(self, values): if not self.user_has_groups('my_library.acl_book_librarian'): if 'manager_remarks' in values: raise UserError( 'You are not allowed to modify ' 'manager_remarks' ) return super(LibraryBook, self).create(values)
- Extend the write() method, as follows:
@api.multi def write(self, values): if not self.user_has_groups('my_library.acl_book_librarian'): if 'manager_remarks' in values: raise UserError( 'You are not allowed to modify ' 'manager_remarks' ) return super(LibraryBook, self).write(values)