We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 948d868 commit f1da5a5Copy full SHA for f1da5a5
edi_oca/models/edi_exchange_consumer_mixin.py
@@ -408,9 +408,16 @@ def _edi_send_via_email(
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
- if "state" in vals and "state" in self._fields:
+ 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
for rec in self:
420
rec._event(f"on_edi_{self._table}_state_change").notify(
421
rec, state=vals["state"]
422
)
- return super().write(vals)
423
+ return res
0 commit comments