Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
20648 Lượt xem

I'm a little bit confused how does res.partner and res.user related by default? 

if we have something like this

    class OpStudent(models.Model):

    _name = 'op.student'

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

    middle_name = fields.Char('Middle Name', size=128)

    last_name = fields.Char('Last Name', size=128, required=True)

    birth_date = fields.Date('Birth Date', required=True)


does it means it creates user automatically when we create student. 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Andrew,
The relationship between 
res.partner and res.user is that res.user inherits from res.partner using an inheritance type called "Delegation Inheritance", See This


Actually only res.users has a "real" relationship to res.partner, because with every user odoo will create a partner (per default no customer and no supplier). this partner will be used e.g. for emails and the followers system in odoo.

But you can have partners without users, too. That will be a normal partner, for defining customers and suppliers.


Ảnh đại diện
Huỷ bỏ
Tác giả

So what is this line of code doing. _inherits = {'res.partner': 'partner_id'} it means that i'm creating my model inside res.partner or how does it work exactly. still trying to figure it out. Thank you for replay.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 23
6350
2
thg 2 16
14359
1
thg 8 19
5976
1
thg 4 25
1262
0
thg 12 20
5010