コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
10276 ビュー

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?

アバター
破棄
著作者

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?

最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
7月 25
4658
2
12月 24
7788
2
11月 24
28565
2
5月 24
7505
3
3月 24
6925