Skip to content

Commit

Permalink
edi_oca: fix consumer mixin exchange record count
Browse files Browse the repository at this point in the history
  • Loading branch information
petrus-v committed Aug 28, 2023
1 parent 1c2033f commit 36cfb7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edi_oca/models/edi_exchange_consumer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _get_exchange_record(self, exchange_type, backend=False, extra_domain=False)
@api.depends("exchange_record_ids")
def _compute_exchange_record_count(self):
data = self.env["edi.exchange.record"].read_group(
[("res_id", "in", self.ids)],
[("res_id", "in", self.ids), ("model", "=", self._name)],
["res_id"],
["res_id"],
)
Expand Down
9 changes: 9 additions & 0 deletions edi_oca/tests/test_consumer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ def test_mixin(self):
"res_id": self.consumer_record.id,
}
exchange_record = self.backend.create_record("test_csv_output", vals)
self.assertEqual(self.consumer_record.exchange_record_count, 1)
self.env["edi.exchange.record"].create(
{
"backend_id": self.backend.id,
"type_id": self.exchange_type_new.id,
"model": "an.other.model.with.same.id",
"res_id": self.consumer_record.id,
}
)
self.consumer_record.refresh()
self.assertEqual(self.consumer_record.exchange_record_count, 1)
action = self.consumer_record.action_view_edi_records()
Expand Down

0 comments on commit 36cfb7b

Please sign in to comment.