Skip to Content
Menu
This question has been flagged
1 Reply
5141 Views

I want to add 'Invoiced' smart button in product.template, an example is in the customers but I don't know how can do that

Avatar
Discard
Best Answer

Inherit the account invoice and use the below code for smart button,(This code for odoo 9)

        <record id="view_product_invoice_line_tree" model="ir.ui.view">
<field name="name">product.account.invoice.line.tree</field>
<field name="model">account.invoice.line</field>
<field name="arch" type="xml">
<tree string="Invoice Line">
<field name="invoice_id"/>
<field name="product_id"/>
<field name="account_id"/>
<field name="quantity"/>
<field name="uom_id"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_inv_line_product_tree">
<field name="context">{}</field>
<field name="domain">[('product_id','in',active_ids)]</field>
<field name="name">Invoices</field>
<field name="res_model">account.invoice.line</field>
<field name="view_id" ref="view_product_invoice_line_tree"/>
</record>
<record id="view_product_template_invoice_buttons_from" model="ir.ui.view">
<field name="name">product.template.invoice.button.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" name="%(account.action_inv_line_product_tree)d"
type="action" icon="fa-shopping-cart">Invoices
</button>
</div>
</field>
</record>

Avatar
Discard
Author

Thank you so much! :)

Related Posts Replies Views Activity
1
Oct 22
2501
2
Mar 21
1372
3
Jul 19
5244
2
Mar 15
3699
0
Mar 15
2968