zoukankan      html  css  js  c++  java
  • Add Customerlize Button in More Button List In Odoo

    There're two commen type of actions in odoo: ir.actions.server,ir.actions.client_multi

    1.Using ir.actions.server

    <record model="ir.actions.server" id="xxxx">
            <field name="name">XXX</field>
            <field name="type">ir.actions.server</field>
            <field name="model_id" ref="model_XXX"/>
            <field name="state">code</field>
            <field name="code">self.do_somthing(cr,uid,ids,context)</field>        
    </record>

    2.Using ir.actions.act_window

    <record model="ir.actions.act_window" id="xxx">
            <field name="name">xxxx</field>
            <field name="res_model">xxx.xxx</field>
            <field name="view_mode">tree,form</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="xxx.xxxxx.xxxx">
            <field name="target">new</field>
    <record>

    about is two type of ir.actions. the first one you can execute your own python code at the server side using state type "code". the second one you can call an existing action in client side.

    3.how to add button in "more" button list

    <record model="ir.values" id="xxxx">
            <field name="name"></field>
            <field name="model_id" ref="xxx_xxxx">
            <field name="model">xxxx</field>
            <field name="key">action</field>
            <field name="key2">client_action_multi</field>
            <field name="value" eval="'ir.actions.act_window,'+str(ref('action_xxx_xx'))"/>
    </record>

    one more thing .....

    the quickest method to create button in more button is like this:

    <act_window id="act_qunar_product_expense_merge_wizard" name="Merge Wizard" src_model="product.expense" res_model="product.expense.wizard" key2="client_action_multi" target="new" view_mode="form" multi="True"/>

    act_window is one of short format of actions. be careful about your src_model and res_model. src_model determine which model the button attach on,and res_model means which model you are using to attach. if you want to using button in tree view set multi true otherwise set it false.

    have fun !

  • 相关阅读:
    OpenLiveWriter博客工具
    mysql主从复制原理分析
    linux mysql主从复制配置
    linux mysql数据库安装
    linux 下安装maven私服
    eclipse新建maven项目和聚合项目
    入门Kubernetes -基础概念
    Java中5种List的去重方法及它们的效率对比,你用对了吗?
    谈一谈程序员的职业发展路线
    虚拟机中如何Linux系统如何访问PC硬盘中的文件(如何将windows下的文件夹挂载到linux虚拟机下)
  • 原文地址:https://www.cnblogs.com/kfx2007/p/4166898.html
Copyright © 2011-2022 走看看