Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
You have to inherit the corresponding template and add a new input field to it and give the name as product_id and also add a field with the same name in the back end model also, ie, crm.lead , for the saving of the data to back end it will process automatically, i think there is no separate controller for the contact form, it uses a built in class to record data to backed.
Just add a input field in the template and with the same name add field in back end, also make the field as not blacklisted in website forms, else the value will not get saved into the back end.
See this: How To Add Dynamic Selection Field In Odoo Website Form
Thanks
HI Thank You for the reply,
I tried the above solution,but the field is appearing as text not as many2one dropdown.
Here is my code
models:
from odoo import fields, models
class Lead(models.Model):
_inherit = 'crm.lead'
product_id = fields.Many2one('product.template','Product')
views:
<odoo>
<template id="contactus_form_attach" inherit_id="website_crm.contactus_form" name="Contact Form Captcha" priority="99">
<xpath expr="//div[hasclass('form-field')][last()]" position="before">
<div class="form-group row form-field o_website_form_required">
<label class="col-lg-3 col-md-4 col-form-label" for="product_id">Product</label>
<div class="col-lg-7 col-md-8">
<input type="product_id" class="form-control o_website_form_input" name="product_id" required="" t-att-value="request.params.get('product_id', '')"/>
</div>
</div>
</xpath>
</template>
</odoo>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up