How to open wizard on click button in odoo/OpenERP
Create .py file for define method and field like below
class wizard_object(models.TransientModel):
_name = 'wizard.object'
field_1 = fields.Text('Field - 1')
field_2 = fields.Text('Field - 2')
@api.multi
def method_name(self):
pass
Create .xml file as below.
<record id="wizard_object_view" model="ir.ui.view">
<field name="name">wizard.object</field>
<field name="model">wizard.object</field>
<field name="arch" type="xml">
<form string="Wizard Demo" version="7.0">
<group>
<field name="field_1"/>
<field name="field_1"/>
</group>
<footer>
<button name="method_name" string="Yes" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="open_wizard_action_id" model="ir.actions.act_window">
<field name="name">Wizard Demo</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.object</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
Create One button when you want to open wizard.
<button name="%(open_wizard_action_id)d" type="action" string="Open Wizard"/>
Create .py file for define method and field like below
class wizard_object(models.TransientModel):
_name = 'wizard.object'
field_1 = fields.Text('Field - 1')
field_2 = fields.Text('Field - 2')
@api.multi
def method_name(self):
pass
Create .xml file as below.
<record id="wizard_object_view" model="ir.ui.view">
<field name="name">wizard.object</field>
<field name="model">wizard.object</field>
<field name="arch" type="xml">
<form string="Wizard Demo" version="7.0">
<group>
<field name="field_1"/>
<field name="field_1"/>
</group>
<footer>
<button name="method_name" string="Yes" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="open_wizard_action_id" model="ir.actions.act_window">
<field name="name">Wizard Demo</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.object</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
Create One button when you want to open wizard.
<button name="%(open_wizard_action_id)d" type="action" string="Open Wizard"/>
Odoo partner
ReplyDeleteThanks for sharing this informative article. This content is very useful.
Odoo Partners
Very informative article, we also do Odoo ERP customization
ReplyDeletehttp://learntechx.com/open-source-erp-crm-solutions
thanks for sharing knowledge.............
ReplyDelete