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.

2

How to modify ViewManager?

By
Marek Toman
on 4/24/13, 9:45 AM 2,671 views

hi, I want to modify ViewManager header in addons/web/static/xml/base.xml by module. based on this article: help.openerp.com/question/2615/how-to-remove-manage-databases/ I created own module like this:

__openerp__.py

{
   'qweb' : ['static/src/xml/base.xml', ],
}

/static/src/xml/base.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <t t-extend="ViewManager">
        <t t-jquery="table.oe_view_manager_header" t-operation="replace">
            <table class="oe_view_manager_header">
                <col width="20%" />
                <col width="35%" />
                <col width="15%" />
                <col width="30%" />
                <tr class="oe_header_row oe_header_row_top">
                    <td colspan="2">
                        <h2 class="oe_view_title" t-if="widget.flags.display_title !== false">
                            <span class="oe_view_title_text oe_breadcrumb_title" />
                        </h2>
                    </td>
                    <td colspan="2">
                        <div class="oe_view_manager_view_search" t-opentag="true" />
                    </td>
                </tr>
                <tr class="oe_header_row">
                    <td>
                        <div class="oe_view_manager_buttons" />
                    </td>
                    <!-- removed COLSPAN="2" here -->
                    <td>
                        <div class="oe_view_manager_sidebar" />
                    </td>
                    <!-- added <TD> here -->
                    <td>
                        some text
                    </td>
                    <!-- end of edit -->
                    <td>
                        <ul class="oe_view_manager_switch oe_button_group oe_right">
                            <t t-if="widget.views_src.length > 1" t-foreach="widget.views_src" t-as="view">
                                <li class="oe_e">
                                    <a t-attf-class="oe_vm_switch_#{view.view_type}" t-att-data-view-type="view.view_type" t-att-title="view.button_label" />
                                </li>
                            </t>
                        </ul>
                        <div class="oe_view_manager_pager oe_right" />
                    </td>
                </tr>
            </table>
        </t>
    </t>
</templates>

But I cannot manage to get this working. Header just never changes. If I try to edit another view (e.g. web-kanban) Im succesful, but dont know why it is not possible to replace any div or table in ViewManager. Tried to install that module, tried to load it with --load=mymodule,web but no success.

1

Hiral Patel (hip)

--Hiral Patel (hip)--
Tiny ERP Pvt Ltd
http://www.odoo.com
913
| 2 1 5
India
--Hiral Patel (hip)--


Hiral Patel (hip)
On 8/7/13, 4:32 AM

Hello,

You need to write your code in between :

<t t-name="ViewManagerAction" t-extend="ViewManager">

</t>

As 'ViewManager' is extended in 'ViewManagerAction', You need to make change in 'ViewManagerAction' and not in 'ViewManager'.

0
sepdau
On 8/7/13, 12:17 AM

Hi I have same problem with you but after ViewManager I add

<t t-name="ViewManagerAction" t-extend="ViewManager">

</t>

It work for me maybe it will work for you :D

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

0 follower(s)

Stats

Asked: 4/24/13, 9:45 AM
Seen: 2671 times
Last updated: 3/16/15, 8:10 AM