Community mailing list archives

a word of caution about base action rules / Automated Actions

Camptocamp France SAS, Alexandre Fayolle - Camptocamp
- 06/23/2016 04:08:43
Hello all,

Last autumn when v9 was released and the sale order / purchase order
workflows, Fabien Pinckaers advocated the use of Automated Actions to
implement workflow customization (the thread is

I tried that approach on a customer project and I am *not* happy with it
at all. The problem is that a given automated actions can only trigger
once in a transaction (apparently to avoid recursion). However, a single
write on a record can trigger many other writes (because computed fields
are updated for instance, or because). The consequence of this can be
hard to track down inconsistencies because the action fired when the
first write was made but was not called again when the dependent field
was updated.

There is no way to define a action which triggers when a given field is
updated, so you naturally end up writing a generic action which triggers
on any write, and do the filtering based on
self.env.context['old_values'] to perform stuff only if some fields have
changed. This approach will silently fail in the case I described in the
previous paragraph.

Alexandre Fayolle
Chef de Projet
Tel : +33 4 58 48 20 30

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex