콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
18979 화면


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




아바타
취소
관련 게시물 답글 화면 활동
2
8월 25
2758
1
7월 25
1103
1
8월 25
1151
0
5월 25
1529
2
4월 25
3724