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

I want to read the one2many field values (Child table) in create method. while I am trying it returns the table object. unable to read the one2many field value through looping  

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

Hello Yognandam,

You can access the values for the one2many field after the super call of the create method.

For example, if we want to access the values of order_line(one2many) in the create method of Sale Order then we can write the super method like this:

@api.model

def create(self, vals):

    res = super(SaleOrder, self).create(vals)

    if res.order_line:

        for line in res.order_line:

              print(line)

    return res

Thanks

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

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

It is saved as new records. I want to update the old record

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 25
1666
2
thg 9 22
9414
2
thg 4 22
4441
0
thg 7 21
7135
5
thg 8 20
18858