From bdde46aab41615316ed1cdc8c0271e5dbb2091fe Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Sun, 3 Nov 2019 22:08:09 +0100 Subject: [PATCH] [FIX] account_asset_batch_compute: Fixing tests --- account_asset_batch_compute/models/account_asset.py | 4 +++- .../tests/test_account_asset_batch_compute.py | 2 +- account_asset_batch_compute/wizards/account_asset_compute.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/account_asset_batch_compute/models/account_asset.py b/account_asset_batch_compute/models/account_asset.py index a8553601..49440fae 100644 --- a/account_asset_batch_compute/models/account_asset.py +++ b/account_asset_batch_compute/models/account_asset.py @@ -19,7 +19,9 @@ class AccountAsset(models.Model): @api.multi @job(default_channel='root.account_asset_batch_compute') def _compute_entries(self, date_end, check_triggers=False): - if self.env.context.get('asset_batch_processing', False): + if self.env.context.get( + 'asset_batch_processing', False + ) and not self.env.context.get('test_queue_job_no_delay', False): results = [] log_error = '' for record in self: diff --git a/account_asset_batch_compute/tests/test_account_asset_batch_compute.py b/account_asset_batch_compute/tests/test_account_asset_batch_compute.py index f5d27265..ad091dd6 100644 --- a/account_asset_batch_compute/tests/test_account_asset_batch_compute.py +++ b/account_asset_batch_compute/tests/test_account_asset_batch_compute.py @@ -108,7 +108,7 @@ class TestAccountAssetBatchCompute(TransactionCase): depreciation_line = self.asset01.depreciation_line_ids\ .filtered(lambda r: r.type == 'depreciate' and r.move_id) self.assertTrue(len(depreciation_line) == 0) - wiz.with_context(test_queue_job_no_delay=True).asset_compute() + wiz.with_context(test_queue_job_no_delay=False).asset_compute() depreciation_line = self.asset01.depreciation_line_ids \ .filtered(lambda r: r.type == 'depreciate' and r.move_id) self.assertTrue(len(depreciation_line) == 0) diff --git a/account_asset_batch_compute/wizards/account_asset_compute.py b/account_asset_batch_compute/wizards/account_asset_compute.py index 7f5ce389..bae67dee 100644 --- a/account_asset_batch_compute/wizards/account_asset_compute.py +++ b/account_asset_batch_compute/wizards/account_asset_compute.py @@ -24,7 +24,9 @@ class AccountAssetCompute(models.TransientModel): self.ensure_one() if not self.batch_processing: return super(AccountAssetCompute, self).asset_compute() - if not self.env.context.get('job_uuid'): + if not self.env.context.get('job_uuid') and not self.env.context.get( + 'test_queue_job_no_delay' + ): description = \ _("Creating jobs to create moves for assets to %s") % ( self.date_end,)