diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-09-15 17:20:01 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-09-15 17:20:01 +0200 |
| commit | ed901bedcb7c8b840ae5cf4731b946e998b8b141 (patch) | |
| tree | 56e555e5c61cf53f72b41302ed8b907570bdfe3f /addons/web/static/src/js/fields | |
| parent | 2dea77fe21dae081df71ecf17f275306bb3e5b89 (diff) | |
| parent | 80f916e8e00e740d481251c0c9ea3a5b5a75a908 (diff) | |
[MERGE] forward port branch saas-16 up to 80f916e8e00
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 8 | ||||
| -rw-r--r-- | addons/web/static/src/js/fields/upgrade_fields.js | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index c2bd4f5d5b8..4cbbf498e82 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -93,8 +93,12 @@ var FieldMany2One = AbstractField.extend({ this._super.apply(this, arguments); this.limit = 7; this.orderer = new concurrency.DropMisordered(); - this.can_create = ('can_create' in this.attrs ? this.attrs.can_create : true) && !this.nodeOptions.no_create; - this.can_write = 'can_write' in this.attrs ? this.attrs.can_write : true; + + // should normally also be set, except in standalone M20 + this.can_create = ('can_create' in this.attrs ? JSON.parse(this.attrs.can_create) : true) && + !this.nodeOptions.no_create; + this.can_write = 'can_write' in this.attrs ? JSON.parse(this.attrs.can_write) : true; + this.nodeOptions = _.defaults(this.nodeOptions, { quick_create: true, }); diff --git a/addons/web/static/src/js/fields/upgrade_fields.js b/addons/web/static/src/js/fields/upgrade_fields.js index ae8cae56ef3..c2c30760abf 100644 --- a/addons/web/static/src/js/fields/upgrade_fields.js +++ b/addons/web/static/src/js/fields/upgrade_fields.js @@ -52,9 +52,9 @@ var AbstractFieldUpgrade = { * * @abstract * @private - * @param {JQuery} the 'Enterprise' label to insert + * @param {jQuery} $enterpriseLabel the 'Enterprise' label to insert */ - _insertEnterpriseLabel: function ($enterprise_label) {}, + _insertEnterpriseLabel: function ($enterpriseLabel) {}, /** * Opens the Upgrade dialog. * @@ -127,6 +127,15 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, { events: _.extend({}, AbstractField.prototype.events, { 'click input': '_onInputClicked', }), + /** + * Re-renders the widget with the label + * + * @param {jQuery} $label + */ + renderWithLabel: function ($label) { + this.$label = $label; + this._render(); + }, //-------------------------------------------------------------------------- // Private @@ -136,8 +145,9 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, { * @override * @private */ - _insertEnterpriseLabel: function ($enterprise_label) { - this.$el.append(' ').append($enterprise_label); + _insertEnterpriseLabel: function ($enterpriseLabel) { + var $el = this.$label || this.$el; + $el.append(' ').append($enterpriseLabel); }, /** * @override @@ -170,8 +180,8 @@ var UpgradeRadio = FieldRadio.extend(AbstractFieldUpgrade, { * @override * @private */ - _insertEnterpriseLabel: function ($enterprise_label) { - this.$('label').last().append(' ').append($enterprise_label); + _insertEnterpriseLabel: function ($enterpriseLabel) { + this.$('label').last().append(' ').append($enterpriseLabel); }, /** * @override |
