Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5820 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
мар. 16
5055
0
мая 21
4594
1
мая 19
3106
2
авг. 18
2911
0
июн. 16
3975