2
0

[FIX] account_asset_batch_compute: Fixing tests

This commit is contained in:
Enric Tobella 2019-11-03 22:08:09 +01:00 committed by Javier Iniesta
parent d94fdeff34
commit bdde46aab4
3 changed files with 7 additions and 3 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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,)