تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3215 أدوات العرض

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!

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أغسطس 25
2693
1
مايو 25
2683
1
أبريل 25
3673
1
أبريل 25
4525
1
أبريل 25
1987