Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3259 Visualizzazioni

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 ?

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
nov 24
28
1
apr 15
4774
1
giu 25
415
2
gen 25
1142
1
ago 22
7772