How to do it...

The new Library Member model should be in its own Python code file, but to keep the explanation as simple as possible, we will reuse the models/library_book.py file:

  1. Add the new model, inheriting from res.partner:
class LibraryMember(models.Model): 
    _name = 'library.member' 
    _inherits = {'res.partner': 'partner_id'} 
    partner_id = fields.Many2one( 
        'res.partner', 
        ondelete='cascade')
  1. Next, we will add the fields that are specific to Library Members:
# class LibraryMember(models.Model): 
    # ... 
    date_start = fields.Date('Member Since') 
    date_end = fields.Date('Termination Date') 
    member_number = fields.Char() 
date_of_birth = fields.Date('Date of birth')

Now, we should upgrade the add-on module to activate the changes.

..................Content has been hidden....................

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