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

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  

Avatar
Abbandona
Risposta migliore

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

   

Avatar
Abbandona
Autore

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

Post correlati Risposte Visualizzazioni Attività
1
gen 25
1655
2
set 22
9406
2
apr 22
4430
0
lug 21
7127
5
ago 20
18839