mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
migrate account_asset_batch_compute
This commit is contained in:
committed by
Javier Iniesta
parent
2db6a14053
commit
d94fdeff34
@@ -1,8 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import api, models, _
|
||||
from odoo import api, models, _
|
||||
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -12,10 +11,6 @@ try:
|
||||
except ImportError:
|
||||
_logger.debug('Can not `import queue_job`.')
|
||||
|
||||
def empty_decorator(func):
|
||||
return func
|
||||
job = empty_decorator
|
||||
|
||||
|
||||
class AccountAsset(models.Model):
|
||||
|
||||
@@ -24,14 +19,17 @@ 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'):
|
||||
if self.env.context.get('asset_batch_processing', False):
|
||||
results = []
|
||||
log_error = ''
|
||||
for record in self:
|
||||
description =\
|
||||
_("Creating move for asset with id %s to %s") %\
|
||||
(record.id, date_end)
|
||||
record.with_delay(description=description)._compute_entries(
|
||||
record.with_delay(
|
||||
description=description)._compute_entries(
|
||||
date_end, check_triggers=check_triggers)
|
||||
return []
|
||||
return results, log_error
|
||||
else:
|
||||
return super(AccountAsset, self)._compute_entries(
|
||||
date_end, check_triggers=check_triggers)
|
||||
|
||||
Reference in New Issue
Block a user