Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3216 Vistas

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
Descartar
Mejor respuesta

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
Descartar

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

Publicaciones relacionadas Respuestas Vistas Actividad
3
ago 25
2722
1
may 25
2688
1
abr 25
3674
1
abr 25
4527
1
abr 25
1988