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 get database name in webclient_templates.xml?

By
Yenthe
on 2/4/15, 5:47 AM 688 views

Hi guys

I would love to add the database name right above the company logo in my Odoo.
The code that shows the image is coded in the template web.menu_secondary under web/views/webclient_templates.xml.
I now want to print the database name here so the user can always see which exact database he is in.
I've 'coded' the place where it should come but now I don't know how to get the database name from here. Is there any way to access it from here?
My code:

<template id="web.menu_secondary">
            <a class="oe_logo" t-att-href="'/web/?debug' if debug else '/web'">
                <span class="oe_logo_edit">Edit Company data</span>
        Database: <!--The db name should be printed here.. -->
                <img src='/web/binary/company_logo'/>
            </a>
            <div>
<!-- Irrelevant code -->
</template>

With kind regards
Yenthe

1

zbik

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


zbik
On 2/4/15, 8:27 AM

Try this, database name:

 <t t-esc="request.db"/>

and company name:

<span t-esc="user_id.company_id.name"/>

Awesome, works like a charm! Is there also a way to get the company name in this template? (I'll accept & upvote it after this)

Yenthe
on 2/4/15, 8:39 AM

Thank you very much Zbik! Accepted & upvoted :)

Yenthe
on 2/4/15, 9:27 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

2 follower(s)

Stats

Asked: 2/4/15, 5:47 AM
Seen: 688 times
Last updated: 3/16/15, 8:10 AM