zoukankan      html  css  js  c++  java
  • action类型的按钮和object按钮的用法

    <div class="oe_right oe_button_box" name="buttons">
    <button class="oe_inline oe_stat_button" icon="fa-flask" name="action_view_sale_order" type="object">
    <field string="相关单据" name="sale_counts" widget="statinfo" />
    </button>
    class是固定格式,icon是样式,name表示动作按钮,type表示类型
    string表示按钮在标签上显示名字,name="sale_counts"表示记录单据条数,是一个方法

    <button class="oe_inline oe_stat_button" icon="fa-truck" name="action_view_wave_picking" type="object">
    <field string="发货单" name="delivery_count" widget="statinfo" />


    </button>
    </div>

    # 新加地方,要记录对账单条数,该客户
    def _get_partner_account_count(self, cr, uid, ids, field_name, arg, context=None):
    res = dict.fromkeys(ids, 0)
    try:
    name=self.browse(cr,uid,ids[0],context=context).name
    obj=self.pool('partner.account.state')
    sale_ids=obj.search(cr,uid,[('partner_id','=',ids)])
    res[ids[0]]=len(sale_ids)
    except:
    print u"err"
    finally:
    return res
    # 新加地方,执行动作找到对应页面
    # 新加地方,执行动作找到对应页面
    def action_partner_account_state1(self, cr, uid, ids, context=None):

    name指的是客户名字
    name=self.browse(cr,uid,ids[0],context=context).name
    act_obj = self.pool.get('ir.actions.act_window')
    mod_obj = self.pool.get('ir.model.data')
    result = mod_obj.xmlid_to_res_id(cr, uid, 'ks_sale.action_partner_account_state',raise_if_not_found=True)
    result = act_obj.read(cr, uid, [result], context=context)[0]

    过滤条件1
    result['domain'] = "[('partner_id','=','"+ name +"')]"
     过滤条件2
    result['domain'] = "[('origin','=',"+ str(ids[0]) +")]"
    这两种都可以,优先指的是过滤条件为2的为标准
    return result
     
     



    <xpath expr="//div[@name='buttons']" position="inside">
    <button class="oe_inline oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d"
    attrs="{'invisible': [('customer', '=', False)]}"
    icon="fa-strikethrough">
    <field string="Sales" name="sale_order_count" widget="statinfo"/>
    </button>
    </xpath>



    跟上面差不多:
    
    






    至于两个按钮区别还没有研究过

  • 相关阅读:
    os
    linux常用命令
    css-基础知识
    awk命令详解
    文献综述
    微信JSAPI支付
    SNMP详解
    SNMP进阶
    SNMP协议入门
    SNMP简单网络管理协议
  • 原文地址:https://www.cnblogs.com/1314520xh/p/6891433.html
Copyright © 2011-2022 走看看