跳至内容
菜单
此问题已终结
1 回复
6082 查看

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

形象
丢弃
最佳答案

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>

形象
丢弃
编写者

Thank you so much! :)

相关帖文 回复 查看 活动
1
10月 22
3854
2
3月 21
2392
3
7月 19
6388
2
3月 15
4336
0
3月 15
3524