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

I added a button to the sale order details tree view. When user hit the button I want to open the form view of the product.

<button name="action_link" string="" type="object" icon="gtk-go-forward"/>

in sale_order_line I put the action:

class sale_order_line(osv.osv):

    def action_link(self, cr, uid, ids, context=None):
        print(ids) 
        # return { ... to open the product form

It prints the id of the sale_order_line, but what must I return to open the product form in the client ?

形象
丢弃
最佳答案

You need to change your button type to "action" , like its done in invoice form when opening a refund form:

 <button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' groups="account.group_account_invoice"/>

and define the action in xml:

<record id="action_account_invoice_refund" model="ir.actions.act_window">
            <field name="name">Refund Invoice</field>
            <field name="res_model">account.invoice.refund</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
           <field name="view_id" ref="view_account_invoice_refund"/>
           <field name="target">new</field>
</record>

You can check the code example at addons/account/account_invoice_view.xml and addons/account/wizard/account_invoice_refund_view.xml

形象
丢弃
相关帖文 回复 查看 活动
1
4月 24
4388
1
6月 24
2474
4
1月 24
38474
1
1月 24
14141
1
5月 22
3654