This question has been flagged

Hi,

I need to create a snippet that calls for information from res.company. I used t-tags in my snippet like for example; 

                                                 <li class="list-group-item">
                                                        <ul class="list-group-submenu">
                                                               <t t-if="res_users.company_id.partner_id.contact_address">
                                                                     <div class="row">
                                                                        <div class="col-md-4">
                                                                            <h10><strong>Address</strong></h10>
                                                                        </div>
                                                                        <div class="col-md-8 ">
                                                                            <t t-esc="res_users.company_id.partner_id.contact_address"/><br/>
                                                                         </div>
                                                                    </div><hr/>
                                                                </t>
                                                         </ul>
                                                    </li>


but as soon as I activate this snippet the snippet-menu under "Insert Blocks" will stop functioning and only a very tiny black row will appear.

Does anyone know how I will get this to work or if it is even possible to use t-tags in snippets? If I can't use t-tags in my snippets what is the option to replace them.

Avatar
Discard
Best Answer

You replace res_users by user_id. Variable user_id represents current login user

<li class="list-group-item">

<ul class="list-group-submenu">

<t t-if="user_id.company_id.partner_id.contact_address">

<div class="row">

<div class="col-md-4">

<h10><strong>Address</strong></h10>

</div>

<div class="col-md-8 ">

<t t-esc="user_id.company_id.partner_id.contact_address"/><br/>

</div>

</div><hr/>

</t>

</ul>

</li>

Avatar
Discard
Author Best Answer

Now it's working. Thank you!

Avatar
Discard

I'm sorry I made a mistake, check user_id instead user. Maybe this will help.