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

I am make a new record in other model, in the repair.order model i have a table the BOM model and i have a table the new "Pre-Packing" model.

in the BOM table i have a button, this botton i need that sent the new record in the "Pre-Packing" model. Sent Repair Order, User, Product_id.id of my BOM table.


When i clicking in button "Solicitar" is sent the record.

i am creating a server action for make this solution but i have a problem whit the syntaxis.

could they help me please!.

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

Excelent

Thank you for your answare 

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

Hi,

For creating record in your "Pre-Packing" model when clicking button "Solicitar" from BOM table, you can just define a function like this which will trigger when clicking the button;

def solicitar_button_func()
values = {
'repair_order_id': self.repair_order_id.id,
'user_id': self.user_id.id,
'product_id': self.product_id.id
}
self.repair_order_related_field_in_BOM_table.write({
'pre_packing_one2many_field': [(0,0, values)]
})

Regards

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 22
7116
1
thg 11 20
3930
3
thg 6 18
15123
0
thg 3 15
4778
0
thg 3 25
2