2017-03-23 07:52:07 +01:00
|
|
|
# Copyright 2016 ACSONE SA/NV
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
|
2021-02-22 18:39:52 +01:00
|
|
|
from odoo import _, models
|
2017-03-23 07:52:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AccountAsset(models.Model):
|
|
|
|
|
2021-02-22 17:48:48 +01:00
|
|
|
_inherit = "account.asset"
|
2017-03-23 07:52:07 +01:00
|
|
|
|
|
|
|
def _compute_entries(self, date_end, check_triggers=False):
|
2019-11-03 22:08:09 +01:00
|
|
|
if self.env.context.get(
|
2021-02-22 17:48:48 +01:00
|
|
|
"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 = []
|
2021-02-22 17:48:48 +01:00
|
|
|
log_error = ""
|
2017-03-23 07:52:07 +01:00
|
|
|
for record in self:
|
2023-03-13 11:16:44 +01:00
|
|
|
description = _(
|
|
|
|
"Creating move for asset with id {rec_id} to {date_end}"
|
|
|
|
).format(
|
|
|
|
rec_id=record.id,
|
|
|
|
date_end=date_end,
|
2021-02-22 17:48:48 +01:00
|
|
|
)
|
|
|
|
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
|
2017-03-23 07:52:07 +01:00
|
|
|
else:
|
|
|
|
return super(AccountAsset, self)._compute_entries(
|
2021-02-22 17:48:48 +01:00
|
|
|
date_end, check_triggers=check_triggers
|
|
|
|
)
|