تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3263 أدوات العرض

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
نوفمبر 24
28
1
أبريل 15
4774
1
يونيو 25
416
2
يناير 25
1147
1
أغسطس 22
7773