Skip to Content
Menu
This question has been flagged
1 Reply
4660 Views

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>   


                                    


Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 16
4178
0
May 21
3029
1
May 19
2212
2
Aug 18
2143
0
Jun 16
3189