Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web_tree_editable_clicks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
web_tree_editable_clicks
Commits
713a8343046c
Commit
713a8343046c
authored
7 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Diff of the desired result
parent
c755553a61c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diffs/view_list_editable.js.diff
+48
-0
48 additions, 0 deletions
diffs/view_list_editable.js.diff
with
48 additions
and
0 deletions
diffs/view_list_editable.js.diff
0 → 100644
+
48
−
0
View file @
713a8343
This documents the desired result this module goes for by overriding involved functions.
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index bc18931..8100d74 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -256,11 +256,28 @@
}, options).then(function () {
$recordRow.addClass('oe_edition');
self.resize_fields();
+ // Local function that returns true if field is visible and editable
+ var is_focusable = function(field) {
+ return field && field.$el.is(':visible:not(.o_readonly)');
+ };
var focus_field = options && options.focus_field ? options.focus_field : undefined;
- if (!focus_field){
- focus_field = _.find(self.editor.form.fields_order, function(field){ return fields[field] && fields[field].$el.is(':visible:has(input)'); });
+ if (!is_focusable(fields[focus_field])) {
+ focus_field = _.find(self.editor.form.fields_order, function(field) {
+ return is_focusable(fields[field]);
+ });
+ }
+ if (focus_field && fields[focus_field]) {
+ var field_node = fields[focus_field].$el;
+ var input_node = field_node.find('input');
+ input_node.select();
+ if (options && options.event_tag && options.event_tag.toLowerCase() == 'input' &&
+ field_node.hasClass('oe_form_field_boolean'))
+ {
+ // Focusing a row by clicking on a check-box: Forward the click event.
+ input_node.click();
+ field_node.click();
+ }
}
- if (focus_field && fields[focus_field]) fields[focus_field].$el.find('input').select();
return record.attributes;
});
}).fail(function () {
@@ -810,7 +827,8 @@
var record_id = $(event.currentTarget).data('id');
return this.view.start_edition(
record_id ? this.records.get(record_id) : null, {
- focus_field: $(event.target).data('field')
+ event_tag: event.target.tagName,
+ focus_field: $(event.target).closest('[data-field]').data('field'),
});
},
/**
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment