Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to use t-tags in snippets

By
Christelle Wehbe
on 3/19/15, 4:09 AM 1,188 views

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.

2

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 3/19/15, 4:23 AM

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>

0
Christelle Wehbe
On 3/19/15, 5:05 AM

Now it's working. Thank you!

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

zbik
on 3/19/15, 7:01 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/19/15, 4:09 AM
Seen: 1188 times
Last updated: 3/19/15, 7:06 AM