summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-03-03 14:01:13 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit00a172b40d0fd7edbf7cd7190b2e9db6345e51b5 (patch)
tree3c2f167816090362ffb8484e3e068fa76591e86b /addons/web/static
parent722cb7cd83192472a10efbdd3783dd5bf61f3fdb (diff)
[FIX] web: adapt 1a9a082d to new fields
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js22
-rw-r--r--addons/web/static/test/fields/relational_fields_tests.js6
2 files changed, 3 insertions, 25 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 3f20d802209..b3b3a26c437 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -567,16 +567,6 @@ var FieldX2Many = AbstractRelationalField.extend({
//--------------------------------------------------------------------------
/**
- * This function is meant to be overriden by the One2ManyField.
- *
- * @private
- * @returns {Boolean} true if the 'Add an item' row should be available in
- * the list renderer, false otherwise
- */
- _hasCreateLine: function () {
- return !this.isReadonly;
- },
- /**
* Instanciates or updates the adequate renderer.
*
* @override
@@ -597,7 +587,7 @@ var FieldX2Many = AbstractRelationalField.extend({
this.renderer = new ListRenderer(this, this.value, {
arch: arch,
mode: this.mode,
- addCreateLine: this._hasCreateLine(),
+ addCreateLine: !this.isReadonly && this.activeActions.create,
addTrashIcon: !this.isReadonly,
});
}
@@ -785,16 +775,6 @@ var FieldOne2Many = FieldX2Many.extend({
//--------------------------------------------------------------------------
/**
- * Overrides enable the 'Add an item' feature if the 'create' action is
- * available.
- *
- * @override
- * @private
- */
- _hasCreateLine: function () {
- return this._super.apply(this, arguments) && this.activeActions.create;
- },
- /**
* Overrides to only render the buttons if the 'create' action is available.
*
* @override
diff --git a/addons/web/static/test/fields/relational_fields_tests.js b/addons/web/static/test/fields/relational_fields_tests.js
index b306c52d0f8..af4a1d9ee18 100644
--- a/addons/web/static/test/fields/relational_fields_tests.js
+++ b/addons/web/static/test/fields/relational_fields_tests.js
@@ -2035,11 +2035,9 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
- '"Add an item" link should be available in edit');
+ assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ '"Add an item" link should not be available in edit either');
- // TODO: click on add an item and test that the select create dialog has no 'Create' button
- // form.$('.o_form_field_x2many_list_row_add').click();
form.destroy();
});