Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
18984 Переглядів


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.

Аватар
Відмінити
Найкраща відповідь

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

Автор Найкраща відповідь

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 {}

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Найкраща відповідь

Hey,

I had the same issue and I solve it by adding footer to the form view :

<footer>
<field name="id" invisible="1"/>
<button string="Create" name="action_close" type="object" class="btn-primary"
attrs="{'invisible': [('id', '!=', False)]}"
/>
<button string="Save" name="action_close" type="object" class="btn-primary"
attrs="{'invisible': [('id', '=', False)]}"
/>

<button string="Cancel" class="btn-secondary" special="cancel"/> footer>

then In my model i define the function action_close : 


def action_close(self):
return {'type': 'ir.actions.act_window_close'}




Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
серп. 25
2764
1
лип. 25
1108
1
серп. 25
1152
0
трав. 25
1532
2
квіт. 25
3729