[FIX] runbot: manage falsy value for frontend_url

This commit is contained in:
Xavier-Do 2022-08-29 15:08:23 +02:00 committed by xdo
parent e27a1b8f71
commit 903ee7d983
2 changed files with 13 additions and 5 deletions

View File

@ -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)]]),

View File

@ -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('<span>' + this.$el.html() + ' <a href="'+this.route+'" ><i class="external_link fa fa-fw o_button_icon fa-external-link "/></a><span>')
var link = ''
if (this.route) {
link = ' <a href="'+this.route+'" ><i class="external_link fa fa-fw o_button_icon fa-external-link "/></a>'
}
this.$el.html('<span>' + this.$el.html() + link + '<span>')
},
_stopPropagation: function(event) {
event.stopPropagation()