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

I have create a custom webform to change product quantity in picking . and  form view is working with data correctly . it's a table view.

I want to know after change the field quantity, how to pass the value to controller . all rows are together.


this is a part of my form template.  i have used input name with brackets but only pass first row values only. please help me how to transfer the dynamic field data from webform to the controller

odoo version-12.0


<t t-foreach="orders_ids" t-as="o">
    <tr style="border-bottom:1px solid black;" >
        <td style="width:10%;">   
            <input type="text" name="pick_id[]" t-att-value="o.name"  />                          
        </td>
                                            
        <td class="text-right"  style="width:20%">
            <input type="number" name="quantity[]" min="0" style="width:100%" t-att-value="o.product_uom_qty" />   
                                    
        </td>
        <td  class="text-right" style="width:20%">   
            <input type="number" name="quantity_done[]" min="0" style="width:100%" t-att-value="o.quantity_done" />                         
        </td>
    </tr>
</t>   


                                    


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

Hi,

We can pass the data to a custom controller using ajax.rpc method.

var a = "Hello"
ajax.rpc('/webform',{a})

here {a} contain data that accessible from controller in dictionary form

@http.route(['/webform'], type='json', auth="public")
def function_name(self,**kwargs ):
print(kwargs)

While printing the kwargs in the function of our controller we will get Hello as the result.

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 3 16
5048
0
thg 5 21
4570
1
thg 5 19
3093
2
thg 8 18
2903
0
thg 6 16
3963