From 903ee7d9830ae9c74df95037231dfa41b80fb7a4 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Mon, 29 Aug 2022 15:08:23 +0200 Subject: [PATCH] [FIX] runbot: manage falsy value for frontend_url --- runbot/controllers/frontend.py | 2 +- runbot/static/src/js/json_field.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 76273899..18ca8e70 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -512,7 +512,7 @@ class Runbot(Controller): ('slot_ids.batch_id.bundle_id', '=', bundle_id), ('params_id.trigger_id', '=', trigger.id), ] - builds = request.env['runbot.build'] + builds = request.env['runbot.build'].with_context(active_test=False) if center_build_id: builds = builds.search( expression.AND([builds_domain, [('id', '>=', center_build_id)]]), diff --git a/runbot/static/src/js/json_field.js b/runbot/static/src/js/json_field.js index 41cb8b44..520b5997 100644 --- a/runbot/static/src/js/json_field.js +++ b/runbot/static/src/js/json_field.js @@ -42,13 +42,21 @@ var FrontendUrl = relational_fields.FieldMany2One.extend({ events: _.extend({'click .external_link': '_stopPropagation'}, relational_fields.FieldMany2One.prototype.events), init() { this._super.apply(this, arguments); - const model = this.value.model.split('.').slice(1).join('_') - const res_id = this.value.res_id - this.route = '/runbot/' + model+ '/' + res_id + if (this.value) { + const model = this.value.model.split('.').slice(1).join('_'); + const res_id = this.value.res_id; + this.route = '/runbot/' + model+ '/' + res_id; + } else { + this.route = false; + } }, _renderReadonly: function () { this._super.apply(this, arguments); - this.$el.html('' + this.$el.html() + ' ') + var link = '' + if (this.route) { + link = ' ' + } + this.$el.html('' + this.$el.html() + link + '') }, _stopPropagation: function(event) { event.stopPropagation()