Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
10273 Visualizzazioni

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
Abbandona
Autore

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?

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
lug 25
4658
2
dic 24
7788
2
nov 24
28565
2
mag 24
7505
3
mar 24
6925