xml - 如何在 OpenERP 中展开和折叠菜单?

标签 xml odoo openerp-7

在 OpenERP 7 中是否有扩展或折叠侧边栏菜单的模块。

或者我们如何在 OpenERP 7 中做到这一点。

最佳答案

如果你想用动画折叠它们,你可以将这些模板添加到你的模块中

    <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>
            <img src='/web/binary/company_logo'/>
        </a>
        <div>
            <div>
                <div class="oe_secondary_menus_container">
                    <t t-foreach="menu_data['children']" t-as="menu">
                        <div style="display: none" class="oe_secondary_menu" t-att-data-menu-parent="menu['id']">
                            <t t-foreach="menu['children']" t-as="menu">
                                <div class="oe_secondary_menu_section" style="cursor: pointer;">
                                    <t t-esc="menu['name']"/>
                                </div>
                                <t t-call="web.menu_secondary_submenu"/>
                            </t>
                        </div>
                    </t>
                </div>
            </div>
        </div>
        <div class="oe_footer">
            Powered by <a href="http://www.odoo.com" target="_blank"><span>Odoo</span></a>
        </div>
    </template>

   <template id="web.webclient_bootstrap" name="Webclient Bootstrap">
        <t t-call="web.layout">
            <t t-set="head">
                <t t-call-assets="web.assets_common"/>
                <t t-call-assets="web.assets_backend"/>
                <script type="text/javascript">
                    $(function() {
                        var s = new openerp.init();
                        <t t-if="init">
                            <t t-raw="init"/>
                        </t>
                        <t t-if="not init">
                            var wc = new s.web.WebClient();
                            wc.setElement($(document.body));
                            wc.start();
                        </t>
                    });
                </script>
            </t>

            <nav id="oe_main_menu_navbar" class="navbar navbar-inverse" role="navigation" groups="base.group_user,base.group_portal">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <div class="navbar-collapse collapse" id="oe_main_menu_placeholder">
                    <t t-call="web.menu"/>
                </div>
            </nav>
            <div class="openerp openerp_webclient_container">
                <table class="oe_webclient">
                    <tr>
                        <td class="oe_leftbar" valign="top">
                            <div groups="base.group_user,base.group_portal">
                                <t t-call="web.menu_secondary"/>
                            </div>
                            <script type="text/javascript">
                                $('.oe_secondary_menu_section').click(function() {
                                    $(this).next().slideToggle(500);
                                });
                            </script>
                        </td>
                        <td class="oe_application"/>
                    </tr>
                </table>
            </div>
        </t>
    </template>

如您所见,我在原始模板中添加了一些内容:

光标样式

<div class="oe_secondary_menu_section" style="cursor: pointer;">
    <t t-esc="menu['name']"/>
</div>

一个 jQuery 函数

<script type="text/javascript">
    $('.oe_secondary_menu_section').click(function() {
        $(this).next().slideToggle(500);
    });
</script>

*它至少适用于 Odoo v8

关于xml - 如何在 OpenERP 中展开和折叠菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30099321/

相关文章:

android - 当软键盘启动时停止页脚出现 : android

xml - XSL递归轴故障?

sql - 使用来自 db2 的 SQL 从 XML Clob 中提取数据

openerp TreeView 中的超链接

python - odoo (openerp) 中的字段错误?

odoo - 域openerp如何比较odoo中的2个日期字段

python - 如何根据 sale.order 中选择的价目表对 sale.order.line 中的 product_id 应用域过滤器?

java - 在相同情况下 @XmlJavaTypeAdapter 被忽略

python - 在odoo的日期字段中添加年份

python-3.x - Odoo 12 - 生成并下载 CSV 文件