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

Is it posible to populate the value from onchange_event in child object to parent_object.

Let us assume, we have sale_order - parent object sale_order_line - child object

by using the onchange product_id in sale_order_line is ir possible to populate the value for the parent object sale_order fields

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

I have the same issue, until now I have not solved it yet. Any help please

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

You could always use

self.pool.get('sale.order').write(.....)

But I've been told that this is neither well apllicable nor good style.

For better help please give more details on what you are trying to do.

Have you thought about using an onchange function in sale_order on sale_order_lines?
If product_id changes the sale_order_line might change which triggers the onchange that has direct acces to the sale_order fields.

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

how can you use self.pool.get('sale.order').write(.....) when you are creating a new object

Maybe I've mistaken your question.

You can use self.pool.get('sale.order').create(....) when you want to create a new record.

But again: Don't do this in practice, if avoidable.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
8015
2
thg 1 21
6183
1
thg 4 24
1797
1
thg 7 23
5818
0
thg 12 17
4500