Tower: upload cetmix_tower_server_queue 16.0.1.2.2 (via marketplace)
This commit is contained in:
23
addons/cetmix_tower_server_queue/models/queue_job.py
Normal file
23
addons/cetmix_tower_server_queue/models/queue_job.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2013-2020 Camptocamp SA
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
|
class QueueJob(models.Model):
|
||||||
|
_inherit = "queue.job"
|
||||||
|
|
||||||
|
QUEUE_JOB_ERROR = 601
|
||||||
|
|
||||||
|
def write(self, vals):
|
||||||
|
"""
|
||||||
|
Override write method to update command status
|
||||||
|
and write error information in the log record
|
||||||
|
"""
|
||||||
|
if vals.get("state") == "failed":
|
||||||
|
log_record = self.kwargs.get("log_record")
|
||||||
|
if log_record:
|
||||||
|
log_record.finish(
|
||||||
|
status=self.QUEUE_JOB_ERROR,
|
||||||
|
error=vals.get("exc_info"),
|
||||||
|
)
|
||||||
|
return super().write(vals)
|
||||||
Reference in New Issue
Block a user