Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
4 Besvarelser
11436 Visninger

Hi

I am trying to create one2many lines from onchange method.  The Parent ID should be specified to create that.

But parent is NewID.

crm.lead(<odoo.models.NewId object at 0x7faf0f2c3750>,)

What can I do ?

Avatar
Kassér

Thanks Mohammed 

Bedste svar

Hi

have you tried using self.update?

self.update({
'attendance_line': [(0, 0, {values})],
})

 This method does not require id of current record

Avatar
Kassér
Forfatter

Thanks Muhammed !!!

Your answer is perfect.

Bedste svar

You can find the full details to update the values in One2many/Many2many using the flags from here

https://hilarlive.wordpress.com/2017/04/22/one2many-or-many2many-flags/

Avatar
Kassér
Bedste svar

Hi Mohammed!

It looks like your solution should solve my problem but i cannot understand how i should do it. Could you explain a bit more?

My problem is the following: i try to create a new sale.order.line in an sale.order which is not yet created.

Thanks in advance for your time :-)

Avatar
Kassér

Thanks a lot for your solution Mohammed. I found how to do. It works well. Thx!

Bedste svar

Tnx Mohammed !!

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
sep. 20
2910
0
apr. 16
3222
3
mar. 16
14029
1
mar. 15
12442
1
apr. 23
5189