2
0
account-financial-tools/account_asset_batch_compute/models/account_asset.py

32 lines
1.0 KiB
Python
Raw Permalink Normal View History

# Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
class AccountAsset(models.Model):
_inherit = "account.asset"
def _compute_entries(self, date_end, check_triggers=False):
if self.env.context.get(
"asset_batch_processing", False
) and not self.env.context.get("test_queue_job_no_delay", False):
2019-10-31 07:20:20 +01:00
results = []
log_error = ""
for record in self:
description = _(
"Creating move for asset with id {rec_id} to {date_end}"
).format(
rec_id=record.id,
date_end=date_end,
)
record.with_delay(description=description)._compute_entries(
date_end, check_triggers=check_triggers
)
2019-10-31 07:20:20 +01:00
return results, log_error
else:
return super(AccountAsset, self)._compute_entries(
date_end, check_triggers=check_triggers
)