Skip to Content
Menu
This question has been flagged
1 Reply
14759 Views

Hi ,

I am new in Odoo . I have created a button and I need to know how to call a wizard  from button click.

Avatar
Discard

Hi,

already many answers can see in forum.Anyway You can refer this link Open A wizard

Author

Can you please suggest how to do it via Xml?

you can define a button with type action

<button name="%(action_view_account_move_reversal)d" states="posted" title="Reverse" icon="fa-refresh" type="action" groups="account.group_account_invoice"/>

Author

I am getting error id not found .Can u help please?

did you configured the button correctly.if you given correctly it will work fine

in the name field give your window action id of the wizard

for ex:

<record id="action_view_account_move_reversal" model="ir.actions.act_window">

give this record <button name="%(action_view_account_move_reversal)d"

Author

Oh that has worked.Thank you

Ok..if you have any queries please free to contact

Author

I have one more doubt that is I need to get default value in wizard on this button click.Can you suggest a solution?

You can pass the value through context to any fields in the button itself

context="{'default_field value':value}"

Author

I have a model allocation.request and I want to pass this id to wizard in a field name subject .This is my button definition. <button string="Cancel" name="%(allocation_equipment.allocation_cancel_action)d" type="action" states="new,approve"/>

Add like this <button string="Cancel" name="%(allocation_equipment.allocation_cancel_action)d" type="action" states="new,approve" context="{'default_subject': 'active_id'}"/>

Author

Thank u so much for your quick help.

Best Answer

Hi,

   Refer this link Open a wizard

How to set default value through context context="{'default_field_name': value}"


Avatar
Discard
Author

Thanks @Deerom Technologies