Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6403 มุมมอง

I want to know how I can return a wizard from a workflow activity, I want to launch a wizard when running 'action_cancel()' action from the mrp.production workflow this way:

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

    '''action_cancel() code here'''

    return {

        'name': 'Cancel',

        'view_type': 'form',

        'view_mode': 'form',

         'res_model': 'mrp.production.cancel',

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

        'target': 'new',

    }

but I get this error: TypeError: this.views_src [0] is undefined http://localhost:8069/web/static/src/js/views.js:639

any idea,

regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Normally is not neccessary but try adding a views key to the return dict, like:

def action_cancel(self, cr, uid, ids, context=None):
'''action_cancel() code here'''
data_obj = self.pool.get('ir.model.data')
dummy, view_id = data_obj.get_object_reference(cr, uid, 'module', 'view_external_id')
 
return {
'name': 'Cancel',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mrp.production.cancel',
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}

change module and view_external_id to match the form view that you want to display

อวตาร
ละทิ้ง
ผู้เขียน

Fine, I've tried this and is working, now if I want to send a signal to the workflow from a python method, something like in this post: https://www.odoo.com/es_ES/forum/help-1/question/how-do-i-activate-a-workflow-transition-from-a-wizard-52519 how I can do that?

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 22
1594
1
ต.ค. 15
6355
2
มี.ค. 15
5630
1
ธ.ค. 21
4225
1
มิ.ย. 21
3738