summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_renderer.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-04 15:08:00 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit3ff7ff3e94e4fe34ec09a45fda04f0c8de33cd32 (patch)
tree077d8ba0b7f3ba1c270e1234125d7ce8c89d012e /addons/web/static/src/js/views/basic/basic_renderer.js
parenta529a928b4a295d5a834bcd8ab9a02433be6ff6a (diff)
[FIX] web: properly evaluate unset numeric values in domain
Before this commit, when a numeric value was not set (for example, a new record with no default_get value), then it was not properly evaluated as 0 in a domain. We also slightly refactored the code so we always use the same method to compute the evaluation context.
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.js38
1 files changed, 0 insertions, 38 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 2aa4479648b..1db0718545e 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -52,44 +52,6 @@ return AbstractRenderer.extend({
});
},
/**
- * Helper method, used to get an object with the 'raw' field values. It is
- * important when we want to evaluate if a record matches a given domain.
- *
- * A basic model record is a tree structure, but we sometimes need 'pure'
- * data, so for example, [1,4] for the value of a one2many, not
- * [{Object}, {Object}].
- *
- * @param {Object} record
- * @returns {Object}
- */
- _getFieldValues: function (record) {
- var result = {};
- _.each(record.getFieldNames(), function (name) {
- var field = record.fields[name];
- var value = record.data[name];
- result[name] = value;
- if (!value) {
- return;
- }
- else if (field.type === 'many2one') {
- result[name] = value.data ? value.data.id || false : false;
- }
- else if (field.type === 'one2many' || field.type === 'many2many') {
- if (value) {
- result[name] = _.pluck(value.data, 'res_id');
- } else {
- result[name] = [];
- }
- }
- else if (field.type === 'boolean') {
- // we want an explicit false value, not null if it is unset
- result[name] = value || false;
- }
- });
- result.id = record.data.id;
- return result;
- },
- /**
* Render the view
*
* @override