0
votes

I have a popup window (form) and a button on it, in OpenERP, picture attached. When I click on the button (for now it does nothing) my form is closed. I want to leave it open after the button click. How can I do that? I am aware of "nodestroy"=True, but I am not sure where to put it, if it is solution.

enter image description here

Here is my XML code:

<record id="replace_all_in_BOM_form" model="ir.ui.view">
    <field name="name">replace.all.in.BOM.form</field>
    <field name="model">product.template</field>
    <field name="priority" eval="20"/>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <label class="text-inline" for="original_name" string="Original" 
        ></label>
        <input name="original_name" id="original_id" ></input>
        <group>
            <field name="default_code" string="Replacement" readonly="1" 
            invisible="0" />    
            <field name="uom_id" invisible="1"  /> 
            <field name="uom_po_id" invisible="1"   />
            <field name="type" invisible="1"   />   
            <field name="categ_id" invisible="1"   /> 
            <field name="name" invisible="1" />             
        </group>
            <button type="object" string="Replace" name="action_replace" />
    </field> 
    </record>

<record id="action5" model="ir.actions.act_window">
    <field name="name">Replace all in BOM</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">product.template</field>           
    <field name="view_type">form</field>
    <field name="target">new</field>
    <field name="view_id" ref="replace_all_in_BOM_form"/>
</record>

<record id="ir_BOM_structure5" model="ir.values">
    <field eval="'client_action_multi'" name="key2"/>
    <field eval="'product.template'" name="model"/>
    <field name="name">Replace all in BOM</field>
    <field eval="'ir.actions.act_window,'+str(action5)" name="value"/>
</record>
1
Please include the code you are currently using for this form.ryanyuyu
@ryanyuyu I have added the XML code for the popup form.SmithMcPatrick

1 Answers

1
votes

You have to return an action that re-open the same pop-up.

To do that, the 'action_replace' method should return:

return {
    'type': 'ir.actions.act_window',
    'res_model': 'your.model',
    'view_type': 'form',
    'view_mode': 'form',
    'res_id': 'id_of_the_wizard',
    'target': 'new',
}