How to do it...

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:

  1. 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)
  1. 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) 
..................Content has been hidden....................

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