mirror of https://github.com/OCA/web.git
[IMP] pre-commit run after update
Includes some manual fixes to silent ESLint warnings.pull/3035/head
parent
b8118b095b
commit
e6a7d763de
|
@ -6,20 +6,23 @@
|
||||||
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
||||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
|
|
||||||
odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require) {
|
odoo.define("web_tree_many2one_clickable.many2one_clickable", function(require) {
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
var ListRenderer = require('web.ListRenderer');
|
var ListRenderer = require("web.ListRenderer");
|
||||||
var ListFieldMany2One = require('web.relational_fields').ListFieldMany2One;
|
var ListFieldMany2One = require("web.relational_fields").ListFieldMany2One;
|
||||||
|
|
||||||
ListRenderer.include({
|
ListRenderer.include({
|
||||||
_renderBodyCell: function(record, node, colIndex, options) {
|
_renderBodyCell: function(record, node, colIndex, options) {
|
||||||
if (!node.attrs.widget && node.attrs.name &&
|
if (
|
||||||
|
!node.attrs.widget &&
|
||||||
|
node.attrs.name &&
|
||||||
this.state.fields[node.attrs.name] &&
|
this.state.fields[node.attrs.name] &&
|
||||||
this.state.fields[node.attrs.name].type === 'many2one') {
|
this.state.fields[node.attrs.name].type === "many2one"
|
||||||
|
) {
|
||||||
// No explicit widget provided on a many2one field,
|
// No explicit widget provided on a many2one field,
|
||||||
// force `many2one` widget
|
// force `many2one` widget
|
||||||
node.attrs.widget = 'many2one';
|
node.attrs.widget = "many2one";
|
||||||
}
|
}
|
||||||
return this._super(record, node, colIndex, options);
|
return this._super(record, node, colIndex, options);
|
||||||
},
|
},
|
||||||
|
@ -32,28 +35,29 @@ odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require)
|
||||||
|
|
||||||
if (!this.noOpen && this.value) {
|
if (!this.noOpen && this.value) {
|
||||||
// Replace '<a>' element
|
// Replace '<a>' element
|
||||||
this.$el.removeClass('o_form_uri');
|
this.$el.removeClass("o_form_uri");
|
||||||
this.$el = $('<span/>', {
|
this.$el = $("<span/>", {
|
||||||
html: this.$el.html(),
|
html: this.$el.html(),
|
||||||
class: this.$el.attr('class') + ' o_field_text',
|
class: this.$el.attr("class") + " o_field_text",
|
||||||
name: this.$el.attr('name'),
|
name: this.$el.attr("name"),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Append button
|
// Append button
|
||||||
var $a = $('<a/>', {
|
var $a = $("<a/>", {
|
||||||
href: '#',
|
href: "#",
|
||||||
class: 'o_form_uri btn btn-sm btn-secondary' +
|
class:
|
||||||
' fa fa-angle-double-right',
|
"o_form_uri btn btn-sm btn-secondary" +
|
||||||
}).on('click', function (ev) {
|
" fa fa-angle-double-right",
|
||||||
|
}).on("click", function(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
self.do_action({
|
self.do_action({
|
||||||
type: 'ir.actions.act_window',
|
type: "ir.actions.act_window",
|
||||||
res_model: self.field.relation,
|
res_model: self.field.relation,
|
||||||
res_id: self.value.res_id,
|
res_id: self.value.res_id,
|
||||||
views: [[false, 'form']],
|
views: [[false, "form"]],
|
||||||
target: 'target',
|
target: "target",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.$el.append($a);
|
this.$el.append($a);
|
||||||
|
|
|
@ -4,13 +4,20 @@
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="assets_backend" name="web_tree_many2one_clickable assets"
|
<template
|
||||||
inherit_id="web.assets_backend">
|
id="assets_backend"
|
||||||
|
name="web_tree_many2one_clickable assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<link rel="stylesheet"
|
<link
|
||||||
href="/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss" />
|
rel="stylesheet"
|
||||||
<script type="text/javascript"
|
href="/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss"
|
||||||
src="/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js"/>
|
/>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue