Skip to content

Commit

Permalink
Merge PR #684 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by guewen
  • Loading branch information
OCA-git-bot committed Oct 21, 2024
2 parents c0e4ef7 + 793f06e commit 8a8da09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions queue_job_batch/models/queue_job_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class QueueJobBatch(models.Model):
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Batch of jobs"
_log_access = False
_order = "id desc"

name = fields.Char(
required=True,
Expand Down
1 change: 1 addition & 0 deletions queue_job_batch/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_queue_job_batch
17 changes: 17 additions & 0 deletions queue_job_batch/tests/test_queue_job_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from odoo.tests import SavepointCase


class TestQueueJobBatch(SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.batch1 = cls.env["queue.job.batch"].get_new_batch("batch 1")
cls.batch2 = cls.env["queue.job.batch"].get_new_batch("batch 2")

def test_default_order(self):
"""we want latest batch on top of the notification list"""
batches = self.env["queue.job.batch"].search(
[("id", "in", (self.batch1 | self.batch2).ids)]
)
self.assertEqual(batches[0].name, "batch 2")
self.assertEqual(batches[1].name, "batch 1")

0 comments on commit 8a8da09

Please sign in to comment.