From c24d1f615ca549ff134fbd250afafc359a591431 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 9 Mar 2017 17:04:04 +0100 Subject: [REF] web: make getContext and getDomain part of dataPoints Before this commit, the getContext and getDomain functions of a dataPoint were only available from a BasicModel "get" call result. As the code is moving towards the creation of a DataPoint class, these two functions should be a part of the dataPoint itself. --- addons/web/static/src/js/views/basic/basic_model.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index ab2b7dcbbee..9f2242751e6 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -26,6 +26,8 @@ odoo.define('web.BasicModel', function (require) { * fieldNames: {string[]}, * fields: {Object}, * fieldAttrs: {Object}, + * getContext: {function}, + * getDomain: {function}, * groupedBy: {string[]}, * id: {integer}, * isOpen: {boolean}, @@ -372,9 +374,6 @@ var BasicModel = AbstractModel.extend({ delete element.relation_field; delete element.rawContext; - element.getContext = this._getContext.bind(this, record); - element.getDomain = this._getDomain.bind(this, record); - return element; }, /** @@ -1772,6 +1771,9 @@ var BasicModel = AbstractModel.extend({ value: value, }; + dataPoint.getContext = this._getContext.bind(this, dataPoint); + dataPoint.getDomain = this._getDomain.bind(this, dataPoint); + this.localData[dataPoint.id] = dataPoint; return dataPoint; -- cgit v1.2.3