Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3270 Widoki

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 ?

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lis 24
28
1
kwi 15
4777
1
cze 25
421
2
sty 25
1157
1
sie 22
7784