zoukankan      html  css  js  c++  java
  • odoo开发笔记 -- 多个视图共用一个模型

    除了写序列优先绑定之外,

    窗口引用的视图id也要绑定,否则页面加载的时候,可能不是自己需要显示的视图。例如:<field name="view_id" ref="cus_111_tree"/>

            <record id="action_customs_×××××××" model="ir.actions.act_window">
                <field name="name">测试</field>
                <field name="type">ir.actions.act_window</field>
                <field name="res_model">xxxxx.customs_×××××××</field>
                <field name="view_mode">tree,form</field>
            </record>
    
            <record id="import_customs_×××××××_action" model="ir.actions.act_window">
                <field name="name">测试进口菜单1</field>
                <field name="type">ir.actions.act_window</field>
                <field name="res_model">xxxxx.customs_×××××××</field>
                <field name="view_mode">tree,form</field>
                <field name="domain">[('inout', '=', 'I'),]</field>
                <field name="view_id" ref="cus_111_tree"/>
            </record>
    
            <record id="export_customs_×××××××_action" model="ir.actions.act_window">
                <field name="name">测试出口菜单2</field>
                <field name="type">ir.actions.act_window</field>
                <field name="res_model">xxxxx.customs_×××××××</field>
                <field name="view_mode">tree,form</field>
                <field name="domain">[('inout', '=', 'E'),]</field>
                <field name="view_id" ref="cus_111_tree"/>
            </record>
            
    
            <record id="cus_111_tree" model="ir.ui.view">
                <field name="name">XXXXXXXXX tree view</field>
                <field name="model">XXXXX.XXXXX</field>
                <field name="arch" type="xml">
                    <tree default_order="create_date desc" >
                        <field name="name"/>
                        <field name="inout"/>
                        <field name="create_uid" readonly="1" string="创建人"/>
                        <field name="create_date" string="创建时间" widget="date"/>
                    </tree>
                </field>
            </record>
  • 相关阅读:
    【2021-03-31】人生十三信条
    【2021-03-30】证明自己是人类忠实的朋友
    【2021-03-29】万物本是无序
    缀点成线
    1比特与2比特字符
    Solution -「LOCAL」「cov. 牛客多校 2020 第三场 I」礼物
    Solution -「HNOI 2007」「洛谷 P3185」分裂游戏
    Solution -「CF 1372E」Omkar and Last Floor
    Solution -「POJ 3710」Christmas Game
    Solution -「CF 1380F」Strange Addition
  • 原文地址:https://www.cnblogs.com/hellojesson/p/9105456.html
Copyright © 2011-2022 走看看