We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01303a0 commit 0b9452dCopy full SHA for 0b9452d
edi_oca/models/edi_exchange_consumer_mixin.py
@@ -404,3 +404,20 @@ def _edi_send_via_email(
404
# Send the email
405
composer.send_mail()
406
return True
407
+
408
+ def write(self, vals):
409
+ # Generic event to match a state change
410
+ # TODO: this can be added to component_event for models having the state field
411
+ state_change = "state" in vals and "state" in self._fields
412
+ if state_change:
413
+ for rec in self:
414
+ rec._event(f"on_edi_{self._table}_before_state_change").notify(
415
+ rec, state=vals["state"]
416
+ )
417
+ res = super().write(vals)
418
419
420
+ rec._event(f"on_edi_{self._table}_state_change").notify(
421
422
423
+ return res
0 commit comments