Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
10185 Tampilan

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
Buang
Penulis

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?

Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
2
Jul 25
4251
2
Des 24
7482
2
Nov 24
28187
2
Mei 24
7234
3
Mar 24
6669