odoo11怎么在tree试图“动作”里面增加按钮?
-
直接上代码:
<?xml version="1.0" encoding="UTF-8"?> <odoo> <data> <!-- Tree view for "material.code" --> <record id="view_material_code_tree_inherit" model="ir.ui.view"> <field name="name">view.material.code.tree.inherit</field> <field name="inherit_id" ref="sun_coding.coding_tree_view_material_code" /> <field name="model">material.code</field> <field name="type">tree</field> <field name="arch" type="xml"> <xpath expr="//field[@name='matk1']" position="after"> <field name="account_id" /> <field name="cost_id" /> <field name="marc_id" /> <field name="marc_jh_id" /> <field name="marc_mrp_id" /> <field name="nosap_id" /> <field name="rmmg1_id" /> </xpath> <xpath expr="//field[@name='number']" position="before"> <field name="state" invisible="1" /> <button name="send_to_sap" string="同步到SAP" type="object" class="btn-primary" attrs="{'invisible': [('state', '=', 'draft')]}" /> </xpath> </field> </record> </data>