تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5787 أدوات العرض

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>   


                                    


الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 16
5047
0
مايو 21
4565
1
مايو 19
3089
2
أغسطس 18
2903
0
يونيو 16
3961