Odoo Help

0

Closing Pop up after clicking on save in odoo

By
Drees Far
on 8/4/15, 5:54 AM 1,869 views


Hello friends!!!

Please, i have a button that opens a pop up.

The problem here is that after creating records in that popup and saving.

It will not close automatically the popup depspite the fact in an other case it will disappear (close).

So, my question is how to control my pop up when i want to close it automatically after clicking on save it will be close and when i want to let open it will appear.

Please help really need an answer.

Thanks and regards.

2
Solanki Shamji
On 8/4/15, 6:47 AM

The default behavior for wizard buttons (button  type="object) as of OpenERP is to immediately close the wizard.

The method called by the button can return an action definition dictionary that will be executed.

When you do not want the wizard to close it is usually because you have several steps. As multi-steps wizards usually have different form views, their button methods simply return actions to open the same wizard record using the next step's view or another view.

Thanks for the answer but i didnt understand how to manage it please

Drees Far
on 8/4/15, 6:49 AM
0
Drees Far
On 8/5/15, 7:20 AM

Thanks for the answer friend.

Here is my code:

def edit_data(self, cr, uid, ids, context=None):

mod_obj = self.pool.get('ir.model.data')

res = mod_obj.get_object_reference(cr, uid, 'test_paie', 'test_paie_form')

momo_id = self.read(cr, uid, ids,['id','year','period','employee_id'])

print("momo_id =" , momo_id)

ref_id = self.check_data(cr, uid,momo_id[0]['employee_id'][0],momo_id[0]['year'],momo_id[0]['period'])

return {

'name': 'New Data',

'view_type': 'form',

'view_mode': 'form',

'view_id': [res and res[1] or False],

'res_model': 'test_paie',

'context': {'default_employee_id':momo_id[0]['employee_id'][0],'default_period' : str(momo_id[0]['period']), 'default_year' : str(momo_id[0]['year'])},

'type': 'ir.actions.act_window',

'nodestroy': True,

'target': 'new',

'flags' : { 'action_buttons' : True,},

'res_id': ref_id,

}

return {}

0

Drees,

If you used the wizard, the Save and Close buttons(on footer) will automatically close the pop up. If you are doing a call of method from wizard, you must return {'type': 'ir.actions.act_window_close'} and your purpose will be served.

If you used dialog box from JS, you must use window.close for that.

How did you manage to add the pop up?

Thanks.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/4/15, 5:54 AM
Seen: 1869 times
Last updated: 8/5/15, 7:20 AM