[FIX] web: adapt 1a9a082d to new fields

This commit is contained in:
Aaron Bohy
2017-04-11 19:44:38 +02:00
parent 722cb7cd83
commit 00a172b40d
2 changed files with 3 additions and 25 deletions
@@ -566,16 +566,6 @@ var FieldX2Many = AbstractRelationalField.extend({
// Private
//--------------------------------------------------------------------------
/**
* 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.
*
@@ -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,
});
}
@@ -784,16 +774,6 @@ var FieldOne2Many = FieldX2Many.extend({
// Private
//--------------------------------------------------------------------------
/**
* 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.
*
@@ -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();
});