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

I crate contact web form. I want to get data in backend models. I mean this form data is manyto one . How to I get it.

Avatar
Discard
Best Answer

Hi,

First, initialise a route

controller.py

@http.route('/web/redirect', type='http', auth="user")
    def function_name(self, job, **kwargs):
    country = request.env['res.country'].sudo().search([])
    return request.render("external-id of template", {
            'country': country,
        })

XML:

<label style="width: 200px" for="country">


         <span class="s_website_form_label_content">Country </span>


  </label>


  <div class="col-sm">


      <select id="country"


         name="country_id"


         class="form-control s_website_form_input">


         <option value="">Country</option>


         <t t-foreach="country" t-as="country">


             <option t-esc="country.name" t-att-value="country.id"/> </t>


      </select>


  </div>


Regards

Avatar
Discard