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

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 ?

Ảnh đại diện
Huỷ bỏ

Thanks Mohammed 

Câu trả lời hay nhất

Hi

have you tried using self.update?

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

 This method does not require id of current record

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

Thanks Muhammed !!!

Your answer is perfect.

Câu trả lời hay nhất

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/

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

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 :-)

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

Tnx Mohammed !!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 20
2989
0
thg 4 16
3292
3
thg 3 16
14133
1
thg 3 15
12534
1
thg 4 23
5229