콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
25169 화면

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
4618
1
6월 24
2711
4
1월 24
38918
1
1월 24
14357
1
5월 22
3822