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

When choosing between model function or workflow action ?

By
Yann Papouin
on 12/13/13, 9:02 AM 602 views

When developing custom modules, I'm still asking what kind of methods should I choose to execute an action. For example for canceling a "stock.picking" object, you have 3 solutions:

#Directly write state to object
picking_obj.write(cr, uid, picking_id.id, {'state':'cancel'}, context=context);

#Use model function
picking_obj.action_cancel(cr, uid, picking_id.id, context=context);

#Use the workflow
wf_service.trg_validate(uid, 'stock.picking', picking_id.id, 'button_cancel', cr)

I know that the first solution should be avoid. But what about the model function and workflow action ?

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

0 follower(s)

Stats

Asked: 12/13/13, 9:02 AM
Seen: 602 times
Last updated: 3/16/15, 8:10 AM