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

Greetings,


We are looking to do a contact form on our website, but want to have the new opportunity already assigned tags based on what the user selects. Either we specify the tags manually or it pulls from the available tags we have defined in the CRM portion. I'm assuming this requires some custom code but I am not seeing anywhere in the docs really where that is. I assume requires manual HTML code and then modifying the model for the DB insert. Is there any docs that shows this and I am missing it?


Thanks!

Avatar
Discard
Best Answer

Hi,

Please try like below.

<t t-set="category_ids" t-value="env['res.partner.category'].sudo().search([])"/>
/> <div t-attf-class="form-group col-xl-6">
<label class="col-form-label label-optional" for="category_id">Category:</label>
<select t-attf-class="tags_selection form-control" name="category_id" multiple="multiple"
id="category_id">
<t t-foreach="category_ids" t-as="category">
<option t-att-value="
category.id"
/> t-att-selected="
partner.category_id.mapped('id').count(category.id) > 0">
<t t-esc="category.name" t-att-value="category.id"/>
/> </option>
</t>


</select>
<script>


$(document).ready(function() {
$('.tags_selection').select2();
});
</script>
</div>


Regards

Avatar
Discard

that didn't work wih me
i am using odoo 15
i've used your code but still can't use multiple selection in my website.
can you please give us another solution.

not working for in odoo 15

Related Posts Replies Views Activity
1
May 25
1723
1
Apr 25
2818
1
Apr 25
3568
1
Apr 25
1145
4
Mar 25
6010