Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


how to pass sale.order active id into wizard?

on 3/26/14, 8:51 PM 4,213 views

Hello, I created a wizard and have a many2one field that is related to the sale.order. I would like to pass in the sale.order active id to the many2one field that is on the wizard.

In the Sale Order form I have a button with the type set to action, and I am using the context to pass in the active id of the sale.order to the sale_order_id field

<button name="%(action_view_wiz_pay_auth_net)d" type="action" string="Pay with Authorize.net" context="{'sale_order_id': active_id}" class="oe_highlight" />

Here is my xml wizard action:

<record id="action_view_wiz_pay_auth_net" model="ir.actions.act_window">
        <field name="name">Credit Card Info</field>
        <field name="res_model">sale.auth.net.payment</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_wiz_auth_net_payment_form"/>
        <field name="target">new</field>

here is the wizard form:

<record id="view_wiz_auth_net_payment_form" model="ir.ui.view">
        <field name="name">wiz.auth.net.payment Form View</field>
        <field name="model">sale.auth.net.payment</field>
        <field name="arch" type="xml">
            <form string="Authorize.net" version="7.0">
                    <field name="cc_num" style="width:300px;"/>
                    <field name="exp_month" style="width:60px;"/>
                    <field name="exp_year" style="width:60px;"/>
                    <field name="ccv_num" style="width:60px;"/>
                    <field name="amount" />
                    <field name="has_dif_billing" />
                    <field name="sale_order_id" style="width:300px;"/>
                <group attrs="{'invisible': [('has_dif_billing','=', False)]}">
                    <field name="partner_id" style="width:300px;"/>
                    <field name="billing_add" style="width:300px;"/>
                    <field name="billing_city" style="width:100px;"/>
                    <field name="billing_state" style="width:60px;"/>
                    <field name="billing_zip" style="width:60px;"/>

                    <button name="make_payment" string="Pay Now" type="object" 
                        context="{'amount': amount, 
                                  'cc_num': cc_num,
                                  'exp_month': exp_month,
                                  'exp_year': exp_year,
                                  'ccv_num': ccv_num,
                                  'billing_add': billing_add,
                                  'billing_city': billing_city,
                                  'billing_state': billing_state,
                                  'billing_zip': billing_zip,
                                  'has_dif_billing': has_dif_billing,
                                  }" class="oe_highlight"/> or
                    <button string="Cancel" special="cancel" class="oe_link"/>

I have another many2one field partner_id that is related to res.partners on my wizard which actually loads the partner that is related to the sale.order. Im not sure why the partner_id is loaded, but not the order_id in the wizard. Can anyone explain why? Thank you


Med Said BARA

--Med Said BARA--
| 5 5 7
--Med Said BARA--
Med Said BARA
On 3/27/14, 2:40 PM


Maybe this Question + Answer can help you

Yes thank you. I had to set the _defaults = { 'sale_order_id': lambda self, cr, uid, context: context.get('sale_order_id', False), }

on 3/27/14, 3:11 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 3/26/14, 8:51 PM
Seen: 4213 times
Last updated: 3/16/15, 8:10 AM