Contributors mailing list archives

Browse archives


Re: db not yet committed when overriding create/update.

DEC, Yann Papouin
- 21/06/2024 11:50:45
You can send your webhook using a callback on the postcommit callback.
Check in the Odoo code for the use of the decorator

class BaseCursor:
    """ Base class for cursors that manage pre/post commit hooks. """

    def __init__(self):
        self.precommit = tools.Callbacks()
        self.postcommit = tools.Callbacks()
        self.prerollback = tools.Callbacks()
        self.postrollback = tools.Callbacks()

Yann PAPOUIN, Ingénieur R&D | DEC

Le ven. 21 juin 2024 à 11:48, Yves Goldberg <> a écrit :
I send a webhook when an event occurs in Odoo.
The problem I have is that when overriding create/update; and triggering my webhook, the data is not yet committed in the db.
(the external system is sending in it's response that the record is not found in the case of create and get the old field value -before changes- for an update).

I tried to use and/or both in my automated action and in my code before the webhook but nothing seems to work.
Any other way I could check?
Thank you
Yves Goldberg

Post to: