Odoo Help

Welcome!

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

0

how return a wizard from workflow activity (Odoo)

By
Adnier Rosello
on 10/5/15, 3:44 PM 887 views

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

2

Axel Mendoza

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/5/15, 6:13 PM

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?

Adnier Rosello
on 10/6/15, 4:22 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 10/5/15, 3:44 PM
Seen: 887 times
Last updated: 10/6/15, 4:11 PM