summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-13 13:13:11 +0200
committerChristophe Simonis <chs@odoo.com>2017-10-13 13:13:11 +0200
commit1da064a1d34b48ff23d8cdf5a1c189c8bbb4eb64 (patch)
treed832553531790ca342cda3b03e6c44097717ff43 /addons/web/static/src/js/views
parent119ae9b5dcaea577bfd91b36565b764990b9de02 (diff)
parent8ee9024a4c888647df9e18861fe5e58b68947469 (diff)
[MERGE] forward port branch saas-16 up to 8ee9024a4c8
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/abstract_view.js3
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js29
-rw-r--r--addons/web/static/src/js/views/form/form_renderer.js2
3 files changed, 18 insertions, 16 deletions
diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/js/views/abstract_view.js
index 594a4507963..a6cfea6e3be 100644
--- a/addons/web/static/src/js/views/abstract_view.js
+++ b/addons/web/static/src/js/views/abstract_view.js
@@ -226,7 +226,8 @@ var AbstractView = Class.extend({
return;
}
- attrs.limit = attrs.mode === "tree" ? 80 : 40;
+ attrs.limit = attrs.mode === "tree" ? 80 :
+ (attrs.widget === 'many2many_tags' ? 1000 : 40);
if (attrs.Widget.prototype.useSubview && !attrs.__no_fetch && !attrs.views[attrs.mode]) {
var context = {};
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 5c6f5d2d851..6884442039e 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -2450,7 +2450,12 @@ var BasicModel = AbstractModel.extend({
_generateChanges: function (record, options) {
options = options || {};
var viewType = options.viewType || record.viewType;
- var changes = _.extend({}, record._changes);
+ var changes;
+ if ('changesOnly' in options && !options.changesOnly) {
+ changes = _.extend({}, record.data, record._changes);
+ } else {
+ changes = _.extend({}, record._changes);
+ };
var withReadonly = options.withReadonly || false;
var commands = this._generateX2ManyCommands(record, {
changesOnly: 'changesOnly' in options ? options.changesOnly : true,
@@ -2496,10 +2501,14 @@ var BasicModel = AbstractModel.extend({
* current value of the parent record.
*
* @param {Object} record
+ * @param {Object} [options] This option object will be given to the private
+ * method _generateX2ManyCommands. In particular, it is useful to be able
+ * to send changesOnly:true to get all data, not only the current changes.
* @returns {Object} the data
*/
- _generateOnChangeData: function (record) {
- var commands = this._generateX2ManyCommands(record, {withReadonly: true});
+ _generateOnChangeData: function (record, options) {
+ options = _.extend({}, options || {}, {withReadonly: true});
+ var commands = this._generateX2ManyCommands(record, options);
var data = _.extend(this.get(record.id, {raw: true}).data, commands);
// 'display_name' is automatically added to the list of fields to fetch,
// when fetching a record, even if it doesn't appear in the view. However,
@@ -2618,6 +2627,7 @@ var BasicModel = AbstractModel.extend({
relRecord = _.findWhere(relRecordUpdated, {res_id: list.res_ids[i]});
changes = relRecord ? this._generateChanges(relRecord, options) : {};
if (!_.isEmpty(changes)) {
+ delete changes.id;
command = x2ManyCommands.update(relRecord.res_id, changes);
didChange = true;
} else {
@@ -3194,16 +3204,7 @@ var BasicModel = AbstractModel.extend({
if (value[0] === 6) {
// REPLACE_WITH
_.each(value[2], function (res_id) {
- r = self._makeDataPoint({
- modelName: x2manyList.model,
- context: x2manyList.context,
- fieldsInfo: fieldsInfo,
- fields: fields,
- parentID: x2manyList.id,
- res_id: res_id,
- viewType: viewType,
- });
- x2manyList._changes.push({operation: 'ADD', id: r.id});
+ x2manyList._changes.push({operation: 'ADD', resID: res_id});
});
var def = self._readUngroupedList(x2manyList).then(function () {
return $.when(
@@ -3315,7 +3316,7 @@ var BasicModel = AbstractModel.extend({
options.fieldName = fields;
}
var context = this._getContext(record, options);
- var currentData = this._generateOnChangeData(record);
+ var currentData = this._generateOnChangeData(record, {changesOnly: false});
return self._rpc({
model: record.model,
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js
index d25d1a423c9..ab5e4beb6b5 100644
--- a/addons/web/static/src/js/views/form/form_renderer.js
+++ b/addons/web/static/src/js/views/form/form_renderer.js
@@ -808,7 +808,7 @@ var FormRenderer = BasicRenderer.extend({
_.each(this.allFieldWidgets[this.state.id], function (widget) {
var idForLabel = self.idsForLabels[widget.name];
var $label = idForLabel ? self.$('label[for=' + idForLabel + ']') : $();
- if (core.debug || widget.attrs.help || widget.field.help) {
+ if (config.debug || widget.attrs.help || widget.field.help) {
self._addFieldTooltip(widget, $label);
}
if (widget.attrs.widget === 'upgrade_boolean') {