I want to add a button to the order_line tree in the sales form, I added the following:
<xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='price_subtotal']" position="after">
<button name="%{action_view_wizard}d" string="" type="action" icon="fa-archive" attrs="{'invisible':[('product_id','=', False)]}"/>
</xpath>
And the master is defined
<record id="check_stock" model="ir.ui.view">
<field name="name">sale_warehouse.check_stock_wizard</field>
<field name="model">sale_warehouse.check_stock_wizard</field>
<field name="arch" type="xml">
<form string="Stock by warehouse">
<group col="1">
<field name="stock" nolabel="1"/>
</group>
<footer>
<button string="Close" class="btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_view_wizard" model="ir.actions.act_window">
<field name="name">Stock by warehouse</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale_warehouse.check_stock_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="check_stock"/>
<field name="target">new</field>
</record>
The button is added normally, but its loading is disabled, so when I click the wizard there is no call, if I remove the button from the tree, the wizard is called ok, but I need to call from order_line because I need to transfer the context using the product_id line to get a margin on each stock.
I am using odoo10. What am I doing wrong?
source
share