Skip to content

Commit

Permalink
[IMP] edi_oca: don't consider exchange records if jobs have been created
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Jun 14, 2024
1 parent 9144e59 commit 0e8c21e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def _check_output_exchange_sync(
len(new_records),
)
for rec in new_records:
rec.with_job = True
job1 = rec.delayable().action_exchange_generate()
if not skip_send:
# Chain send job.
Expand Down Expand Up @@ -437,6 +438,7 @@ def _output_new_records_domain(self, record_ids=None):
("type_id.direction", "=", "output"),
("edi_exchange_state", "=", "new"),
("exchange_file", "=", False),
("with_job", "=", False),
]
if record_ids:
domain.append(("id", "in", record_ids))
Expand Down Expand Up @@ -613,6 +615,7 @@ def _check_input_exchange_sync(self, record_ids=None, **kw):
len(pending_records),
)
for rec in pending_records:
rec.with_job = True
rec.with_delay().action_exchange_receive()

pending_process_records = self.exchange_record_model.search(
Expand All @@ -631,6 +634,7 @@ def _input_pending_records_domain(self, record_ids=None):
("type_id.direction", "=", "input"),
("edi_exchange_state", "=", "input_pending"),
("exchange_file", "=", False),
("with_job", "=", False),
]
if record_ids:
domain.append(("id", "in", record_ids))
Expand Down
1 change: 1 addition & 0 deletions edi_oca/models/edi_exchange_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class EDIExchangeRecord(models.Model):
compute="_compute_retryable",
help="The record state can be rolled back manually in case of failure.",
)
with_job = fields.Boolean(help="Technical field to know if jobs have been created already.")

_sql_constraints = [
("identifier_uniq", "unique(identifier)", "The identifier must be unique."),
Expand Down

0 comments on commit 0e8c21e

Please sign in to comment.