Welcome!

Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Sign up

You need to be registered to interact with the community.
This question has been flagged
1 Reply
10 Views

Hey Cyllo community, anyone have experience with delegation inheritance? I'm stuck and could use a hand!

Avatar
Discard

Here's how you can achieve delegation inheritance in Odoo to add extra fields to an existing model without altering its structure. This setup uses a Many2one relationship to link the extension to the original model, inheriting the fields seamlessly. The child model gets all fields of the parent, but the database table structure remains separate. class EmployeeExtension(models.Model): _name = 'employee.extension' _inherits = {'hr.employee': 'employee_id'} # Delegates to hr.employee employee_id = fields.Many2one('hr.employee', required=True, ondelete='cascade') extra_field = fields.Char(string='Extra Info')

Avatar
Discard

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!