[FIX] runbot: adapt for 16.0

This commit is contained in:
Xavier-Do 2023-06-22 14:22:47 +02:00
parent 6107c0aefb
commit ebb531f4a4
4 changed files with 17 additions and 16 deletions

View File

@ -15,7 +15,7 @@ from . import dockerfile
from . import event
from . import host
from . import ir_cron
from . import ir_ui_view
from . import ir_qweb
from . import project
from . import repo
from . import res_config_settings

View File

@ -991,6 +991,9 @@ class BuildResult(models.Model):
child._ask_kill(lock=False)
def _wake_up(self):
user = request.env.user if request else self.env.user
self._log('wake_up', f'Wake up initiated by {user.name}')
if self.local_state != 'done':
self._log('wake_up', 'Impossibe to wake up, state is not done')
else:

13
runbot/models/ir_qweb.py Normal file
View File

@ -0,0 +1,13 @@
from ..common import s2human, s2human_long
from odoo import models
from odoo.http import request
class IrQweb(models.AbstractModel):
_inherit = ["ir.qweb"]
def _prepare_frontend_environment(self, values):
response = super()._prepare_frontend_environment(values)
values['s2human'] = s2human
values['s2human_long'] = s2human_long
return response

View File

@ -1,15 +0,0 @@
from ..common import s2human, s2human_long
from odoo import models
from odoo.http import request
class IrUiView(models.Model):
_inherit = ["ir.ui.view"]
def _prepare_qcontext(self):
qcontext = super(IrUiView, self)._prepare_qcontext()
if request and getattr(request, 'is_frontend', False):
qcontext['s2human'] = s2human
qcontext['s2human_long'] = s2human_long
return qcontext