summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-09-02 13:24:51 +0000
committerYannick Tivisse <yti@odoo.com>2019-09-05 07:34:33 +0000
commitf60db9b93a64bff51bdf961ecd8366c8c1e169df (patch)
tree5653508a3ed8023eaf34e02ad5dde2c77059c85e /addons/web/static/src/js/fields
parent95fefe6cc53c5a732046e7b1fa50c2924005d2c3 (diff)
[FIX] web: kanban: global click and 'image' widget
Let's assume a kanban view with oe_kanban_global_click className (i.e. clicks on the card open the record in a form view), and an image with the 'image' widget. This is for instance the case of the hr.employee kanban view. Before this rev., clicking on the image didn't open the record in form view.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js14
-rw-r--r--addons/web/static/src/js/fields/field_registry.js1
2 files changed, 14 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 8ec2ad142a6..350ce9fa767 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -1867,6 +1867,17 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
},
});
+var KanbanFieldBinaryImage = FieldBinaryImage.extend({
+ // In kanban views, there is a weird logic to determine whether or not a
+ // click on a card should open the record in a form view. This logic checks
+ // if the clicked element has click handlers bound on it, and if so, does
+ // not open the record (assuming that the click will be handle by someone
+ // else). In the case of this widget, there are clicks handler but they
+ // only apply in edit mode, which is never the case in kanban views, so we
+ // simply remove them.
+ events: {},
+});
+
var FieldBinaryFile = AbstractFieldBinary.extend({
description: _lt("File"),
template: 'FieldBinaryFile',
@@ -3266,6 +3277,7 @@ return {
FieldPdfViewer: FieldPdfViewer,
AbstractFieldBinary: AbstractFieldBinary,
FieldBinaryImage: FieldBinaryImage,
+ KanbanFieldBinaryImage: KanbanFieldBinaryImage,
FieldBoolean: FieldBoolean,
BooleanToggle: BooleanToggle,
FieldChar: FieldChar,
@@ -3278,7 +3290,7 @@ return {
FieldFloatTime: FieldFloatTime,
FieldFloatFactor: FieldFloatFactor,
FieldFloatToggle: FieldFloatToggle,
- FieldPercentage : FieldPercentage,
+ FieldPercentage: FieldPercentage,
FieldInteger: FieldInteger,
FieldMonetary: FieldMonetary,
FieldPercentPie: FieldPercentPie,
diff --git a/addons/web/static/src/js/fields/field_registry.js b/addons/web/static/src/js/fields/field_registry.js
index 942e6fc094a..9adb578639f 100644
--- a/addons/web/static/src/js/fields/field_registry.js
+++ b/addons/web/static/src/js/fields/field_registry.js
@@ -39,6 +39,7 @@ registry
.add('CopyClipboardText', basic_fields.TextCopyClipboard)
.add('CopyClipboardChar', basic_fields.CharCopyClipboard)
.add('image', basic_fields.FieldBinaryImage)
+ .add('kanban.image', basic_fields.KanbanFieldBinaryImage)
.add('binary', basic_fields.FieldBinaryFile)
.add('pdf_viewer', basic_fields.FieldPdfViewer)
.add('monetary', basic_fields.FieldMonetary)