[FIX] account_asset_batch_compute: Fixing tests
This commit is contained in:
parent
d94fdeff34
commit
bdde46aab4
@ -19,7 +19,9 @@ class AccountAsset(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
@job(default_channel='root.account_asset_batch_compute')
|
@job(default_channel='root.account_asset_batch_compute')
|
||||||
def _compute_entries(self, date_end, check_triggers=False):
|
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 = []
|
results = []
|
||||||
log_error = ''
|
log_error = ''
|
||||||
for record in self:
|
for record in self:
|
||||||
|
@ -108,7 +108,7 @@ class TestAccountAssetBatchCompute(TransactionCase):
|
|||||||
depreciation_line = self.asset01.depreciation_line_ids\
|
depreciation_line = self.asset01.depreciation_line_ids\
|
||||||
.filtered(lambda r: r.type == 'depreciate' and r.move_id)
|
.filtered(lambda r: r.type == 'depreciate' and r.move_id)
|
||||||
self.assertTrue(len(depreciation_line) == 0)
|
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 \
|
depreciation_line = self.asset01.depreciation_line_ids \
|
||||||
.filtered(lambda r: r.type == 'depreciate' and r.move_id)
|
.filtered(lambda r: r.type == 'depreciate' and r.move_id)
|
||||||
self.assertTrue(len(depreciation_line) == 0)
|
self.assertTrue(len(depreciation_line) == 0)
|
||||||
|
@ -24,7 +24,9 @@ class AccountAssetCompute(models.TransientModel):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if not self.batch_processing:
|
if not self.batch_processing:
|
||||||
return super(AccountAssetCompute, self).asset_compute()
|
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 = \
|
description = \
|
||||||
_("Creating jobs to create moves for assets to %s") % (
|
_("Creating jobs to create moves for assets to %s") % (
|
||||||
self.date_end,)
|
self.date_end,)
|
||||||
|
Loading…
Reference in New Issue
Block a user