Browse Source

Merge pull request #885 from guewen/11.0-fix-m2o-clickable-button

[FIX] web_tree_many2one_clickable: Check if the node is a field
pull/922/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
b5232fd247
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      web_tree_many2one_clickable/__manifest__.py
  2. 4
      web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js

2
web_tree_many2one_clickable/__manifest__.py

@ -7,7 +7,7 @@
{ {
"name": "Clickable many2one fields for tree views", "name": "Clickable many2one fields for tree views",
"summary": "Open the linked resource when clicking on their name", "summary": "Open the linked resource when clicking on their name",
"version": "11.0.1.0.0",
"version": "11.0.1.0.1",
"category": "Hidden", "category": "Hidden",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"author": "Therp BV, " "author": "Therp BV, "

4
web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js

@ -10,7 +10,9 @@ odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require)
ListRenderer.include({ ListRenderer.include({
_renderBodyCell: function (record, node, colIndex, options) { _renderBodyCell: function (record, node, colIndex, options) {
if (!node.attrs.widget && this.state.fields[node.attrs.name].type === 'many2one') {
if (!node.attrs.widget && node.attrs.name &&
this.state.fields[node.attrs.name] &&
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';

Loading…
Cancel
Save