diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-10-25 10:15:25 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-10-26 08:19:43 +0200 |
| commit | 7b8001a847e9a89dc7203c5cf2ead715b9bcd45b (patch) | |
| tree | 8bf531ef19484312aab48360ae54d37948b2b79f /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | 0b41f21c165f231054488fd660c04f2ac3dc2560 (diff) | |
[FIX] hr_expense,web: explicit link_to command for o2m
The ORM doesn't automatically link subrecords when it receives an
update command for a one2many. However, it may be necessary when
the default_get returns existing records for a one2many field. It
only worked before this rev. for the hr_expense model because of an
hack from 2016 (to reproduce: go to Expenses, check some expenses
from the list view, in Actions, click on 'Submit to Manager', the
new hr_expense_sheet contains the checked expenses (one2many), and
the webclient only sent an update command by linked subrecord).
This rev. fixes the problem properly: when the default_get returns
existing subrecords for a one2many field, a link_to command (4) is
generated alongside the update (1) command.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index ac812aeb734..91102d8dd90 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -1068,7 +1068,9 @@ QUnit.module('relational_fields', { assert.deepEqual( obj.turtles, [ + [4, 2, false], [1, 2, {turtle_foo: 'blip'}], + [4, 3, false], [1, 3, {turtle_foo: 'kawa'}] ], "should have properly created the x2many command list"); @@ -1097,7 +1099,9 @@ QUnit.module('relational_fields', { // unchanged state with the command 1, but this seems more // difficult. assert.deepEqual(args.args[0].turtles, [ + [4, 2, false], [1, 2, {turtle_foo: 'blip'}], + [4, 3, false], [1, 3, {turtle_foo: 'kawa'}] ], 'should send proper commands to create method'); } |
