diff options
| author | kujiu <kujiu@users.noreply.github.com> | 2017-07-25 13:43:37 +0200 |
|---|---|---|
| committer | ged-odoo <ged@odoo.com> | 2017-07-25 13:43:37 +0200 |
| commit | 2771b23a35c27165b54904a9e433202a5cd226af (patch) | |
| tree | 0f876d657f17b18f80400bb504853b3fa3f33d0f /addons/web/static/tests/views/basic_model_tests.js | |
| parent | 044b8b1240e6b294d26df10fa4518b97ae4879f0 (diff) | |
[FIX] web: do not delete records for one2many with widget=many2many
Some one2many fields are called with a many2many widget to unlink
records instead of delete them. But this behavior was modified with the
new views and the records were deleted anyway.
In this commit, we restore the previous behavior, and create a FORGET
command in basic model
to do that. Note that the widget='many2many' is a hack, and a better way
to accomplish this is to use a new custom option. But this would be a
fix for master (PR #18413)
Diffstat (limited to 'addons/web/static/tests/views/basic_model_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/basic_model_tests.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/views/basic_model_tests.js index 7f7547262da..9e8e64edde6 100644 --- a/addons/web/static/tests/views/basic_model_tests.js +++ b/addons/web/static/tests/views/basic_model_tests.js @@ -361,27 +361,27 @@ QUnit.module('Views', { assert.strictEqual(record.data.product_ids.count, 2, "there should be two records in the relation"); - // trigger a 'REMOVE' command on the existing record + // trigger a 'DELETE' command on the existing record var existingRecordID = record.data.product_ids.data[0].id; - model.notifyChanges(resultID, {product_ids: {operation: 'REMOVE', ids: [existingRecordID]}}); + model.notifyChanges(resultID, {product_ids: {operation: 'DELETE', ids: [existingRecordID]}}); assert.deepEqual(model.localData[x2mListID]._changes, [{ operation: 'ADD', id: newRecordID, }, { operation: 'UPDATE', id: newRecordID, }, { - operation: 'REMOVE', id: existingRecordID, + operation: 'DELETE', id: existingRecordID, }], "_changes should be correct"); record = model.get(resultID); assert.strictEqual(record.data.product_ids.count, 1, "there should be one record in the relation"); - // trigger a 'REMOVE' command on the new record - model.notifyChanges(resultID, {product_ids: {operation: 'REMOVE', ids: [newRecordID]}}); + // trigger a 'DELETE' command on the new record + model.notifyChanges(resultID, {product_ids: {operation: 'DELETE', ids: [newRecordID]}}); assert.deepEqual(model.localData[x2mListID]._changes, [{ - operation: 'REMOVE', id: existingRecordID, + operation: 'DELETE', id: existingRecordID, }], "_changes should be correct"); record = model.get(resultID); assert.strictEqual(record.data.product_ids.count, 0, @@ -827,7 +827,7 @@ QUnit.module('Views', { assert.ok(_.isObject(category_value), "category field should have been fetched"); assert.strictEqual(category_value.data.length, 1, "category field should contain one record"); model.notifyChanges(resultID, {category: { - operation: 'REMOVE', + operation: 'DELETE', ids: [category_value.data[0].id], }}); assert.ok(model.isDirty(resultID), "record should be considered dirty"); |
