This question has been flagged
1 Reply
8460 Views

Hi all,

i'm reading about "delegation inheritance" in "Odoo 10 Developments essentials" book.

In the example there is:

```

from odoo import Model, fields

class User(models.Model):

    _name="res.users"

    _inherits = {"res.partner": "partner_id"}

    partner_id = fields.Many2one("res.partner")

```

in this example I don't know why there is M20 in "partner_id" field.

I agree that to a user corresponds only one "res_partner" but I don't understand why to a "partner" can correponds many users.

Anyone can help me to understand?

Avatar
Discard
Author

Hilar AK thanks for your answer,

I think the answer is "this is actually setting relation". Could you explain it better?

My doubt is why to a partner can correpond many users.... Is there this possibility in oddo interface? If yes, where?

Best Answer

This is actually setting relation, where the targeted model's fields are now accessible through this relation. We can have multiple inheritances and the new table created in DB contains your new fields and fields which delegates the inherited object fields (fields storing IDs from inherited tables.

reference: 

https://www.odoo.com/documentation/12.0/reference/orm.html#delegation

https://www.odoo.com/forum/help-1/question/delegation-inheritance-in-odoo-v8-when-is-it-useful-84890

Avatar
Discard