Skip to content

Commit

Permalink
[FIX] edi_oca: do not try to automatically re-process input_processed…
Browse files Browse the repository at this point in the history
…_error records
  • Loading branch information
nilshamerlinck authored and QuocDuong1306 committed Jul 25, 2024
1 parent 94a72d0 commit 10b28d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def _input_pending_records_domain(self, record_ids=None):
return domain

def _input_pending_process_records_domain(self, record_ids=None):
states = ("input_received", "input_processed_error")
states = ("input_received",)
domain = [
("backend_id", "=", self.id),
("type_id.direction", "=", "input"),
Expand Down
21 changes: 21 additions & 0 deletions edi_oca/tests/test_backend_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,24 @@ def test_input(self):
job = self.backend.with_delay().exchange_process(record)
created = job_counter.search_created()
self.assertEqual(created[0].name, "Process an incoming document.")

def test_input_processed_error(self):
vals = {
"model": self.partner._name,
"res_id": self.partner.id,
"edi_exchange_state": "input_received",
}
record = self.backend.create_record("test_csv_input", vals)
record._set_file_content("ABC")
# Process `input_received` records
job_counter = self.job_counter()
self.backend._check_input_exchange_sync()
created = job_counter.search_created()
# Create job
self.assertEqual(len(created), 1)
record.edi_exchange_state = "input_processed_error"
# Don't re-process `input_processed_error` records
self.backend._check_input_exchange_sync()
new_created = job_counter.search_created() - created
# Should not create new job
self.assertEqual(len(new_created), 0)

0 comments on commit 10b28d7

Please sign in to comment.