跳至内容
菜单
此问题已终结
3268 查看

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 ?

形象
丢弃
相关帖文 回复 查看 活动
0
11月 24
28
1
4月 15
4775
1
6月 25
419
2
1月 25
1155
1
8月 22
7777