Embedding Models using delegation inheritance

Delegation inheritance allows us to reuse data structures, without actually duplicating them in the database. This is done by embedding a Model inside another. UML terms this is a composition relationship: the child cannot exist without the parent, but the parent can exist without the child.

For example, for the core User Model, each record contains a Partner record, and so has all of the fields you find on a Partner available, plus a few fields that are specific to Users.

For the Library project, we want to add a Library Members Model. Members will be able to borrow books, and have a library card that can be used when borrowing books. We want to record the card number, and we also want to be ...

Get Odoo 12 Development Essentials - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.