summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_renderer.js
diff options
context:
space:
mode:
authorRobot Odoo <xmo+roboto@odoo.com>2019-04-02 15:46:39 +0200
committerGitHub <noreply@github.com>2019-04-02 15:46:39 +0200
commit9aea7ae1627e7af10fb03677142ccfc5333f654e (patch)
tree1233647e18260747f3fd315f79f4cae8b06bc0f6 /addons/web/static/src/js/views/basic/basic_renderer.js
parenta82dbe4d680149b9bf15b7a122c6f8bd1b3582fa (diff)
parent8ea5a40417c2da2e82db66ad36fbf1e8e78bbe11 (diff)
[MERGE] web,*: list view improvements
This branch brings several improvements related to the list view: - grouped list views are now editable - 'expand' attribute can be used to open by default the first level groups - if there are a lot of groups, a pager is displayed (instead of having all groups in the same page) - when grouped on a many2one field, custom buttons (on the many2one comodel) can be inserted in each group's header - we can edit several records in a row in editable list views - editable lists do not flicker anymore when switching a row to edit mode - we can navigate through the cells in list views with the arrows (in readonly) Co-authored-by: Aaron Bohy aab@odoo.com Co-authored-by: David Monjoie dmo@odoo.com Co-authored-by: Martin Geubelle mge@odoo.com Co-authored-by: Ravi Gadhia rga@odoo.com Task 1915702 closes odoo/odoo#31756 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_renderer.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_renderer.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js
index 6f5fa263ba8..f741e11b789 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -91,8 +91,7 @@ var BasicRenderer = AbstractRenderer.extend({
*/
confirmChange: function (state, id, fields, ev) {
this.state = state;
-
- var record = state.id === id ? state : _.findWhere(state.data, {id: id});
+ var record = this._getRecord(id);
if (!record) {
return this._render().then(_.constant([]));
}
@@ -351,6 +350,19 @@ var BasicRenderer = AbstractRenderer.extend({
return _.findWhere(this.allModifiersData, {node: node});
},
/**
+ * This function is meant to be overriden in renderers. It takes a dataPoint
+ * id (for a dataPoint of type record), and should return the corresponding
+ * dataPoint.
+ *
+ * @abstract
+ * @private
+ * @param {string} [recordId]
+ * @returns {Object|null}
+ */
+ _getRecord: function (recordId) {
+ return null;
+ },
+ /**
* @private
* @param {jQueryElement} $el
* @param {Object} node