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>
</record>
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">
<group>
<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>
<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;"/>
</group>
<footer>
<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"/>
</footer>
</form>
</field>
</record>
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