I want to add a button to the order_line tree in the sale form, I added like this:
<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 wizard 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 ok but its load as disable and so when clicked the wizard is no call, if I take the button out the tree the wizard is called ok, but I need to be call from the order_line becouse I need to pass the context with product_id of the line to get the stock in each warehouse.
I'm using odoo10. What I'm doing wrong?