Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
3018 Ansichten

I know that I can add trigger fields to limit when an automated action runs (it will only run if there is a change to one of the trigger fields) but is there a way I can know WHICH field has been updated?

Avatar
Verwerfen

odoo automated action which field

Beste Antwort

Automated Actions that are triggered to run on UPDATE can run multiple times, depending on the model, because updates to one field might trigger updates to other fields.

One easy way to understand how this all works is to create a simple Automated Action that runs on every update (does not use trigger fields) and posts a message to the chatter with the old values (note that the record will contain the new values).

Use code like this:

for record in records:
record.message_post(body=env.context['old_values'][record.id])


When we create a new Sales Order and choose a Customer (no other fields are given values) we will see:



You can see that the Automated Action is called five times as the triggers of updates cycle through.

Avatar
Verwerfen