To achieve this we need to create a form tag in our template and in that form we have to create some input elements such as a date picker, two checkbox and one submit button. Now on the click of submit button we want form data in out controller.
Problem Statement 1
On submit button click get all form data for example (one date picker value and two checkbox value). In this scenario we want to get all form data in our controller. Remember that the form data will be fetched in the form of python dictionary in our controller. In our second scenario we will get only checkbox value in our controller.Read More: Inherit web login controller in Odoo
Get Web Form or Template Value in Odoo Controller
get_web_form_value_in_controller.xml
get_web_form_value_in_controller.py
Read More: Invoke controller class function from another controller in odoo
Problem Statement 2
In our second scenario we will manipulate only two checkbox values which we have got on submit button. To achieve this functionality we will modify our controller code like below.get_web_form_value_in_controller.py
As you can see that now we have only two checkbox values in our controller as per our need.
7 Comments
can you tell me code javascript? how can html know if link go to /tes1 ?
ReplyDeleteTo access the kw dictionary attribute you do it with the get() method, for example
ReplyDeletekw.get('start_date')
really help ful, thanks dude
ReplyDeletehow to get related field vlaue in Controllers odoo14?
ReplyDeleteyou can set store True in related fields to get value in controller
Deletehow to display one2many field in a website using controller?
ReplyDeleteu can use foreach loop of qweb template
Delete