ir.actions.act_window浅谈

ir.actions.act_window浅谈

  1. 看到页面想了解view详情,打开开发者模式,选择 管理视图 查看视图外部标志
    在这里插入图片描述

  2. 通过外部标志,查看数据库中的ir_action_view
    在这里插入图片描述
    3.重点是view_id来跳转282 view界面,打开数据库ir_ui_view
    在这里插入图片描述
    4.product_view 中找到action 其中product_template_tree_view对应的就是view_id 282

        <record id="product_template_action" model="ir.actions.act_window">
        <field name="name">Products</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">product.template</field>
        <field name="view_mode">tree,form,kanban</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="product_template_tree_view"/>   
        <field name="context">{"search_default_filter_to_sell":1}</field>
        
        <menuitem action="product_template_action"
        id="menu_product_template_action"
        parent="base.menu_product" sequence="1" />
    
  3. product_view 中找到 product_template_tree_view

     <record id="product_template_tree_view" model="ir.ui.view">
         <field name="name">product.template.product.tree</field>
         <field name="model">product.template</field>
         <field name="arch" type="xml">
             <tree string="Product">
                 <field name="name"/>
                 <field name="categ_id"/>
                 <field name="type"/>          
                 <field name="state"/> 
                 <field name="uom_id" invisible="1"/>
             </tree>
         </field>
     </record>
    

6.相关的view视图
id name inherit_id
     
product_template_tree_view – product.template.product.tree  
product_template_search_view – product.template.search  
product_template_form_view – product.template.common.form  
product_template_kanban_view-- Product.template.product.kanban  
     
product_template_only_form_view-- product.template.product.form product.product_template_form_view

7.其他视图继承

    <record id="product_template_action" model="ir.actions.act_window">
        <field name="name">Products</field>
        <field name="res_model">product.template</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{}</field>
    </record>

   <menuitem name="Products" 
        id="menu_mrp_product_form" 
        action="product_template_action"
        parent="menu_mrp_bom"/>

8.主要连接
其中action连接主要靠modle product.template而不是id
比如把id名字改掉如下图 依旧有效连接
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值