summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
AgeCommit message (Collapse)Author
2018-09-03[FIX] web: tab selects first many2one entry without triggering spurious createlen-odoo
Suppose you select a customer for a sale order. You type the beginning of his name "think", and a name_search is triggered which finds matching results, with first result "Think Big Systems". There are three ways to select it: click, enter or tab. Now there can be a warning set on this customer ("Bad client, only accept cash", or "good client, offer discount"). In that case, clicking on tab would trigger the onchange displaying the warning, but it would also set floating to true, which means a dialog to create client "think" would appear. This happens if the onchange is delayed, and thus the call to reset the floating state is triggered only after the focusout completed, instead of before. Coauthored with @aab-odoo opw 1866619 opw 1874475
2018-08-07[FIX] web: re-add title attribute for many2many tags that got lostAndreas Perhab
Co-authored-by: Nicolas Martinelli <nim@odoo.com> Closes #25693
2018-07-05[FIX] web: handle onchange on a on2many with an embedded one2many on ↵len-odoo
multiple pages Suppose there is a one2many field embedded in a one2many, (say we are viewing record A with one2many field B itself with a one2many C). Furthermore, there is a second page of the one2many field B. If an onchange is applied on B, then the server replies with a 1 command for all B records attached to the currently viewed object A. This includes a list of commands [[5], [4, C_id]*] for each B record, in particular B records that are on the second page. Since they are on the second page, they might not have been fetched by the frontend; in that case the corresponding C_ids are thus unknown. As a consequence, on save the frontend sends a command 0 to create the records for all unknown C_ids. Since it doesn't have any value to give to the 0 command, the row creation usually crash in the backend. Another wrong behaviour is fixed at the same time: if the server sends an update on the list of C ids with 4 commands. In that case, if the record has not been prefetched, we have no way to know if the list changed or not. To solve this, when we receive the 4 commands by the server, we send back 4 commands. coauthored by @aab-odoo opw 1835936
2018-06-22[FIX] web: onchange on not loaded inline list viewNicolas Lempereur
Let's assume a one2many A inside a form view, such that the one2many views (list, not editable, and form) are defined inline, and there is an onchange on A. There is another inline one2many B editable list displayed in the inner form view (and B isn't in the list). There are two records on the one2many A, both of them having one record in their one2many B. Edit the first record of A, and edit it's subrecord in B. Click on save. This triggers an onchange on A and the onchange returns a command 5 (DELETE_ALL), and two commands 1 (UPDATE). Now edit the second record of A, and simply close the dialog (e.g. 'Discard'). Save the main record: the record in one2many B of the second record of A has been duplicated. This occured because the code in BasicModel messed up information coming from the onchange (UPDATE command) and from the read (performed when opening the second record), thus producing a CREATE command instead of an UPDATE one. This rev. ensures to properly mix the read data with the onchange result, by transfering the changes over the list datapoint created after the read. opw-1836785 closes #25330
2018-06-15[FIX] web: do no drop invalid record in list on discardAlexandre Kühn
Revision on b09f0c99 The intent of the previous commit was to no drop records in a list on discard in the following cases: - when they have been created from a `default_get` - when they have been created from an `onchange` that result from a `default_get` Before the commit above, the kind of records that were abandoned in those cases are stated as invalid, which happens when a record has a required field that is empty. The case of an `onchange` that is not involved in a `default_get` was not considered in the fixes above. In fact, this is the intent behaviour in most cases. However, if the items in the list are created from such an `onchange`, we should not drop them. This commit fixes the bug where records in a list that are created from an `onchange` are wrongly abandoned. Here is the new logic to abandon a record on discard in a list: - the record that is marked as "do not abandon" should not be abandoned; - a record that is registered as a "not new addition" in the list should not be dropped; - a record that is registered as a "new addition" in the list, and has been updated afterwards, should not be dropped; - a record that is not new should not be dropped; opw-806650
2018-06-06[FIX] web: new record with o2m also with new records prevent name_getLucas Perais (lpe)
Have a model A with a o2m to B. In the list have a field B > m2o > C Also have a sequence field (widget handle) on B Then Create a record A Arrange yourself to have two new records B popping right away (through an onchange) in the o2m. Their C field have to be empty Resequence those two B lines with the handle Before this commit, there was a traceback when trying to do an name_get on the C fields Since both of them are empty, there is no record in the localData Hence, no model. And also no records anyway, so no need to do a name_get After this commit, there is no traceback, the name_get is avoided when no data is to be fetched OPW 1853088 closes #24988
2018-05-29[FIX] web: domain evaluation in parented m2o in o2m listLucas Perais (lpe)
Model A has a o2m to model B Model B has a m2o parent_id on B In A's form, add a B item, then in the m2o, create record Save and New Click on the m2o Before this commit, the python crashed on name_search. This was because we sent the virtual ids to it After this commit, there is no crash OPW 1850212 closes #24948
2018-05-28[FIX] web: o2m editable decorated, paged, ordered supports adds/cancelLucas Perais (lpe)
Have a decorated (conditional on field) editable list, with a default_order. Have more records than the pager allows. Add an item, and hit escape to cancel addition. Before this commit, the cancellation crashed because the first record on the other page was trying to evaluate the decoration for its row, which is wrong in the first place. This was because creating a record increases the limit of the list, to be able to see the record being created. At cancellation though, that limit was never decreased. After this commit, the whole flow happens without problem. OPW 1844495 closes #24682
2018-05-23[FIX] web: only abandon records on discard without savepointAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/9a9da5763b38a3bce54e9c4870af0032e38cacc3 The intent of the commit above was to no abandon records in a list on discard when these records have been created from a `default_get`. Also, the `default_get` may also perform an `onchange` that could create more records. The records from this `onchange` must also be included in the "do not abandon" rule. However, the rule was too relax, so that any following `onchanges` from a user interaction was also considered into this rule. As a result, it was not possible to abandon such records. With this fix, we restrict the rule to `default_get` (already the case) and only the `onchange` right after a `default_get`. Any record created on an `onchange` from a user interaction after a `default_get` should be abandoned on discard. Representation of creating the list: savepoint |----------|-----------|-------||--------|-------> create default_get onchange1 onchange2 record in the list is created by default_get or onchange1 => do not abandon on discard record in the list is created by onchange2 => abandon on discard
2018-05-18[FIX] web: show names of many2one on default_getAlexandre Kühn
Before this commit, some records in a list did not show the name of their many2one fields. This case occurs when the records in the list are created from a default_get, and the records do not fit in a single page. In that case, the records in the first page correctly display the names of their many2one fields, but not the records in the other pages. Fixes #24547
2018-05-18[FIX] web: pass unique ids on `name_get` rpcAlexandre Kühn
Before this commit, when a list contains records with many2one fields that contain the same values, duplicate ids were passed to the server on rpc `name_get`. For instance, if 40 records in a list refer to a Unit of Measure with id "1" whose displayed_name is "unit(s)", the server receives a long list of ids with simply the value "1". Also, the server responds with a list of displayed_name, in this case a list of 40 strings "unit(s)". With this commit, we always pass unique ids to the server on rpc `name_get`.
2018-05-16[FIX] web: sort relational fields by their nameslen-odoo
When sorting records according to a many2one field in a list view embedded in a form view, the js would sort according to their ids, in a seemingly arbitrary order. Thus sorting records according to a field with values in ("a", "b", "c") could be sorted as "a", "a", "c", "b" instead of "a", "a", "b", "c". We make the comparison on the name of the field instead. opw 1838860
2018-05-08[FIX] web: use correct href in link for m2oMohammed Shekha
With a better href, many2one in readonly mode can be opened in new tab. Related to task: #32919
2018-05-04[FIX] web: one2many form view with action buttonAaron Bohy
Assume a one2many field inside a form, displaying field A in its list view, and a field B in its (dialog) form view. Moreover, there is an action button in the dialog, which updates the value of B. Before this rev., B wasn't correctly reloaded when the button was clicked, because the BasicModel reloaded the fields on the list view (i.e. field A), whereas it should reload the fields in both views. This fix is twofold. First, we force the viewType to 'form' when the record is reloaded, instead of the default ('list'), so that fields in the form view are correctly reloaded. Second, when we open the form view in the dialog, we add the fields of the list view to the dict of fields of the form view, so that the form is aware of those fields and can ask the model to reload them (still without displaying them). Fixes #24189
2018-05-03[FIX] web: inline views should share their fieldsNicolas Martinelli
This causes issues (already 3, and counting...) This reverts commit 27c9f838d35f36f6fe8d68068ed96c5c58d9d186. opw-1840984 opw-1841041 opw-1841000
2018-05-02[FIX] web: inline views should share their fieldsLucas Perais (lpe)
Have a One2Many The views of that o2m define two inline views: the list and the form in the list view, put a field that isn't in the form and used in a domain Try to add an item to the list The form pops up Fill in the data and save & close Before this commit: It crashed when evaluating the domain on a field using the field that is not in the form After this commit: Subviews share their fields in a special object on the parent record In our case, the form view checks in that shared resource if the fields it is supposed to initialize are there. Hence, this flow doesn't crash anymore OPW 1837511 closes #24350
2018-04-23[FIX] web: handle nested x2m default valuesChristopher Ormaza
The initial rev. odoo/odoo@2d3ecf2 that was supposed to handle this use case was in fact only dealing with one command as default value for nested x2m, not more. The basic model can now handle multiple commands. Closes #24241
2018-04-17[FIX] web: handle x2m commands with reference as defaultMartin Geubelle
Before this rev. it was not possible to define a value for a reference field in x2m commands as default value. Courtesy of @kaerdsar. Closes #24070
2018-04-17[FIX] web: focus select in reference widgetMartin Geubelle
In the reference widget, the focus was always on the input (many2one) even though the first select (with the model) was not set. Thanks to @kaerdsar for the original PR. Partially closes #24070
2018-04-13[FIX] web: BasicModel: default_get on o2m with date fieldAaron Bohy
Before this rev., a crash occured when a default_get returned a command 0 (CREATE) for a one2many, with a value for a date(time) field (e.g. [0, false, {some_date_field: '2018-12-08'}]). This was because the related values (inside the commands) weren't parsed. This only impacted date and datetime fields, for which the parsing converts the string into a moment instance. Fixes #23672
2018-04-13[FIX] web: o2m list with field datetime from serverLucas Perais (lpe)
Have the create_date field displays on a one2many list Try to add a record onto the list Before this commit, when the virtual record is added onto the list it crashes because the datetime field is undefined and cannot be parsed After this commit, It doesn't crash though the value would have to wait the save on the main record to be updated (because it is the create_date) OPW 1834250 closes #24097
2018-04-12[FIX] web: one2many: add new record with 'Save & New'Aaron Bohy
Consider the following scenario involving a one2many list (non editable) inside a form view: - click on 'Add an item', a model opens, - fill the fields and click on 'Save & Close', - reopen the freshly created record, - maybe make some changes (this is optional, but makes sense), - click on 'Save & New', - fill the fields and click on 'Save & Close', -> the second created record isn't added to the list. The problem comes from the fact that when the dialog is opened for the second time (in this case by clicking on a record), the 'save' handler registers an 'UPDATE' command. While this is correct for the 'Save & New' click (as we update an existing record), this isn't for the second record which doesn't exist yet, and thus requires an 'ADD' command. This rev. ensures that the two cases are handled in the 'save' handler given to the dialog. OPW 1829723
2018-04-05[FIX] web: no record abandon on discard from default_get/onchangeAlexandre Kühn
Before this commit, when some records were created from an `onchange`, we have the following weird behaviour: Suppose that this record has some required fields that are empty. When we click on this record, then somewhere else, the record disappears from the list. This is because the records contains invalid fields, and it is wrongfully assuming that the record to be discarded comes from "Add an item". A previous commit [1] fixed a bit this issue with `default_get`, but since it relied on a fragile heuristic, we decide to apply the correct fix with this commit. [1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65
2018-03-28[FIX] web: correctly display reference field in subviewLucas Perais (lpe)
Have a form view with a O2M. The model at the 'many' end has a reference field Have a record of the second model display in a modal (by clicking on a record in the o2m list) Before this commit: The field reference was not filled up This was because the fields to fetch on the modal creation weren't correctly set. Obvisouly, it also created problem when trying to change the record on the modal: spawning tracebacks because the reference field was not present in the local datas After this commit: The display of the reference field is as expected both in the original form and in the modal OPW 1829822 closes #22468 closes #23896
2018-03-22[FIX] web: don't loose focus when editing cell in listLucas Perais (lpe)
Have a list with readonly modifiers on at least one column. Have the first record of the list be readonly as computed by the modifier Create and edit a second record Enter a value in the cell and hit TAB Before this commit: The focus on the targetted cell was lost and the rendering of the cell was in mode readonly This was because the baseMode of the modifier dict was applied to one and only one node (== one column) and hence to *all* the records After this commit: The rendering and keyboard TAB navigation works as expected in the list editable The baseMode concept has been sharpened and each cell now has one OPW-1816569 OPW-1824979 closes #23809 closes #22859 closes #23436
2018-03-22[FIX] web: Make accessible with keyboard the delete button on o2m fields ↵Luis González
(#23719) * [FIX] web: Make accessible with keyboard the delete button on o2m fields Currently, the delete button in one2many fields (trash icon) is not reachable when using the keyboard, because it's neither a link, nor a button or any other interactable HTML element, but a `<span>`. This change causes that button to be an actual HTML button keeping the same appearance, so it may be reached when using the keyboard. * [FIX] web: Modify test to expect button instead of span as o2m trash icon Since buttons to delete records in o2m fields (the trash icon) were changed from `<span>` to `<button>` to be able to access them with the keyboard, the test need to be modified so it expect the new element type and doesn't break.
2018-03-15[FIX] web: add many records in m2m listLucas Perais (lpe)
Have a model with a m2m (field A) this m2m has also a m2m (and displayed as m2m tags in the view) (field AA) Have a domain on field A, to trigger the search view selection Click on add an item Select everything in the modal, making sure that there is more than 40 records Click on Select Before this commit: There was a traceback indicating the local data did not contain records >= 40 This was because the internal data repository was constrained by a limit After this commit: We adapt the limit of the local data repository and there is not traceback OPW 1823400
2018-03-14[FIX] web: x2m: properly reset limit/offset to initial valueGéry Debongnie
When we discard an element, we want to make sure that the new state is not corrupted by previous user operations. In our case, we possibly had a limit and an offset values modified by the user. This could lead to unpleasant situations, with incorrect data displayed on the form view. Note that this actually fixes a new bug introduced by commit https://github.com/odoo/odoo/commit/e7fab234201e357da52c3576ad2e8fc9ceee9359 (this is the commit that introduces the tempLimitIncrement attribute)
2018-03-14[FIX] web: unselect current row before changing pageGéry Debongnie
The issue here is quite simple. If we are editing a multipage one2many field, then we click on the pager, we need to properly unselect the current row. If we do not do that, then we can enter invalid data. For example, assume that there is a readonly field. We click on add, it creates a (virtual) record with no value for that field. When we click on the pager, we select the next page, and bypass all validation.
2018-03-14[FIX] web: prevent issues with pager and x2m and limitGéry Debongnie
When we are in the process of adding a record, we do not want to update the pager count. The reason is that if the user is at the limit (so, 1-40/40, no pager visible), then click on add, there will be a pager shown with 1-40/41. Now, imagine that the record currently being added as a required field, and the user clicks on the pager. In that case, we need to discard the newly added record (bringing the total back to 40), then move to next page, which does not exist anymore. So, to fix this issue, we simply consider that a record being added does not count, from the point of view of the pager.
2018-03-12[FIX] web: better experience for one2many edition (paged)Géry Debongnie
A big problem with the o2m edition happens when the user has a full page (so, in general, 40 records) and click on add. If the o2m is in editable="bottom" mode (which is actually a really common usecase), then the next record will be added at the end. However, since we have a limit of 40, it will immediately go to the next page. The effect is even weirder when there is a required field in the tree view. In that case, the new record appears correctly, the user can edit it, then, as soon as the required fields are set, it will immediately disappear from the current screen. In this commit, we have a really simple solution: we simply increase the limit in this case. An interesting thing is that it is actually temporary: when the user goes to the next page, the limit is back to its original value (due to the pager click: it resets the value to what the pager knows).
2018-03-01[FIX] web: prevent footer from being rerenderedGéry Debongnie
In some cases, the footer in a form view dialog could be duplicated. The reason was that the form view was rerendered completely, footer included, by the renderer, out of the formcontroller control (it is the formcontroller's job to move the footer buttons to the footer). A possible fix is to work on the form renderer to make it aware that the footer buttons are expected to be only rendered once, but it has the disadvantage to be a fix specific to this issue, and any other form view behaviour with some side effects may have the same issue. This commit tries to prevent the form view from rerendering itself completely in those cases. This also has the disadvantage of possibly not being a complete fix, if some edge cases are missed. However, I have the feeling that we still want to avoid rerendering the full view if possible.
2018-02-26[FIX] web: multi pages ordered o2m with onchangeAaron Bohy
Let's assume a one2many displayed over several pages with a default order such that a record, say R, that would normally be on page 1 is actually on another page. Moreover, there is an onchange on that one2many which converts all commands 4 (LINK_TO) into commands 1 (UPDATE), which is standard in the ORM. When the first line of the one2many was edited, the record R was fully loaded, whereas it shouldn't have been (as it is not on the current page). So basically, a useless read was performed. Moreover, if there was an x2many field in the one2many list, a crash occurred because relational data of R that shouldn't have been read wasn't postprocessed by the BasicModel. The useless read occurred because the one2many subrecords weren't correctly sorted before checking if some of them/some of their fields should be read. This is not the case anymore. OPW-1816800
2018-02-23[FIX] web: one2many and onchange corner case issueAaron Bohy
Let's assume a one2many list view inside a form view, displaying a single char field A. There is an onchange on the form view returning a command 0 (CREATE) for the one2many. The command 0 only specifies a value for field A. The one2many list isn't editable, so when a sub-record is clicked, it is open in a form view (in a dialog). In this form view, an x2many field B is displayed in a sub list or kanban view. Before this rev., it crashed when the user tried to open the created one2many sub-record (returned by the onchange) in the form view, because of the presence of the x2many field B, which wasn't correctly processed by the BasicModel (its value was undefined, whereas it must be a valid, empty, dataPoint). Moreover, the limit of the x2many field B wasn't set, so a pager was displayed as soon as it contained at least one record. Fixes #22050
2018-02-16[FIX] web: BasicModel: onchange on X2M: handle command 6Aaron Bohy
Before this rev., when an onchange returned a command 6 for an x2many field, it was completely ignored by the BasicModel.
2018-02-16[FIX] web: BasicModel: fetch nested x2manys after onchangeAaron Bohy
When onchange RPCs return a command 4 (LINK TO), the res_id of the record to link is given, and the BasicModel has to read the fields in the view for that record. When one of those fields is an x2many (for instance, displayed with widget many2many_tags), the subrecords in the relation must be read as well (at least their display_name). Before this rev., this last part wasn't done by the BasicModel, and as a consequence, the many2many_tags widget was always empty, even though there were records in the relation. Same thing applied to reference fields, but this is way more uncommon. This rev. ensures that x2manys and reference fields are correctly fetched in this scenario.
2018-02-16[FIX] web: discard new record with empty required fieldAlexandre Kühn
Before this commit, there is an issue with one2many lists with records that have been created on 'default_get': if the record has a required field that is empty, when the user clicks on this empty required field and then somewhere else, the record is removed from the list. The cause of this bug is that these records have invalid field changes, here the required field that is empty. As a consequence, it checks whether the record is "new", and if so, removes it visually from the editable list. (Note: a record is "new" when it is not stored in DB). This behaviour is expected when discarding records created from "Add an item". However, that is not intended for records that have been created as default items of the list. These records are still considered as "new" items, because they are not stored in DB, but they should stay in the list on discard. This commit solves the issue by making an additional check before assuming that the record for which we discard changes comes from "Add an item": if the record in the list has been created before user interacts on the list (in other words, the record has been added in the list when the user accesses it), then we should not remove the record from the list, even though the record has some invalid fields from the savepoint (e.g. empty required). opw-806650
2018-02-01[FIX] web: sequence handlers on modal's one2many listLucas Perais (lpe)
From a form view (say Bill of materials) Edit the form Click on a bom line Click on the external button that makes the product form pop up change the order of suppliers on that product Before this commit, a JS traceback was raised This was because the changing object was not present in the localData that the Model object holds or more accurately, it was not the **right** model object that was targetted and this was due to the propagation of the resequence event After this commit, no error is thrown, and the resequencing works as expected OPW 807196
2018-01-24[FIX] web: handle nested x2m default valuesMartin Geubelle
A `default_get` for a x2many field can return a new list of commands for one of its x2many field, like [[0, 0, { 'groups_id': [[6, 0, [1, 2, 3]]], }]] where [1, 2, 3] is a list of existing ids. This use case was not correctly handled by the BasicModel because `_makeDefaultRecord` was not recursive. Closes #22401
2018-01-18[FIX] web: fix crash when creating record with too many default valuesGéry Debongnie
When creating a record with many default values, it could happen that the number of ids returned by the default get (or onchange) exceeds the limit for the form view. For example, we can see the issue in the expenses list view. We can increase the limit in the pager, to a value higher than 40. Then, clicking on select all, then on 'Submit to manager' in the action menu will result in a traceback. The Submit to manager action will trigger a new action with a context key 'active_ids' with a large number of ids. After that, the web client will execute the server actions, which will return a new action with a context key 'default_expense_line_ids' with a bunch of ids. Then, it will attempt to create a form view. This will call the makeDefaultRecord method in the basic model. This method will generate the commands for the one2many, for all ids, but will only load the 40 first sub records. After, it will attempt to apply the onchanges, with some code that assumes that all operations of type 'ADD' correspond to a local datapoint. In this commit, we fix the code to properly work with operations of type ADD with a res_id, but with no id. In that case, we simply generate a command 'LINK_TO', since the value has not been changed. opw 804370
2018-01-17[FIX] web: fix issue with multiple pages and relational fieldsGéry Debongnie
When fetching x2manys in a x2many, the basic model did not properly sort the internal data structure before fetching the data. This is usually not an issue, except when we have an order which is different from the order of the res_ids. In that case, it can cause crash in some conditions, because the results from the fetchx2manybatched were applied to the wrong datapoint. To reproduce this issue, some specific conditions needs to be met. I think that it is easier to refer to the test, instead of trying to explain that. In this commit, we properly sort the data at the correct place. Note that this probably solves a bunch of other related issues, caused by the fact that the internal structure was corrupted.
2018-01-17[FIX] web: remove dead codeAlexandre Kühn
Cleaning dead code from these commits that have been reverted: 41fe7f9d1113d026b226b136b4477aaaf9f1f638#diff-54fd886cc58f994ad518ee72df4d3edeR50 2a5488619da22cfd901963dd141e722b195e82ab#diff-f96b339a9374f74489f1f98755e9787bL9253 41fe7f9d1113d026b226b136b4477aaaf9f1f638#diff-86d6d41b5bb7499bf055258d05549d59R3111 With these final changes, we hope to stop the many issues that have occured with binary fields, from these commits: 255e8ca3d92e3a77d7c2a145677623518bc2f978 7813a8e714f268983b0be88827ae1c8ad887e6c7 41fe7f9d1113d026b226b136b4477aaaf9f1f638 2a5488619da22cfd901963dd141e722b195e82ab What remains is the format of binary fields in list views without widgets, which shows the bin_size instead of the base64 string representation... ... Rest assured, the computation is in JS, so there are no 'bin_size' shenaningans!
2018-01-15[FIX] web: disable {bin_size: true} on binary fieldsAlexandre Kühn
Revision on 41fe7f9d1113d026b226b136b4477aaaf9f1f638 This commit intended to reduce the network load when reading records with binary fields. This was made possible by enforcing the contextual key `bin_size` to be set for records with binary fields. However, it is causing some issues (see #22222, #22231) which are: - write with bin_size:true generates a traceback - read/search_read with bin_size:true breaks some images on some views (e.g. base.view_partner_form) Since the problems outweight the gain of these changes, we revert them.
2018-01-12[FIX] web: contexts on field widgets + enforce bin_size for binaryAlexandre Kühn
Field widgets now have a key 'context' that let them extend the context of the dataPoint (e.g. list). In particular, widgets on binary fields enforce the contextual item {bin_size: True}, so that the server gives the size of the binary field as its value, instead of its content. This change on binary fields reduces network load when accessing a view with binary fields.
2018-01-11[FIX] web: prevent crash in some rare casesGéry Debongnie
When we have a form view with a one2many with an onchange, and with lines which contains a x2many, and more lines that the limit (so more than one page), and the read is not in the same order as what is displayed because we have a widget=handle, then we might have a problem when we delete one of the lines, if the onchanges tries to change the x2many. This is due to the fact that the order of the basicmodel datapoint is not preserved by the various operations going around. I think that we may still have a few other issues of this type, but it is actually quite difficult to establish. In any case, this situation is now properly handled. opw 804530
2018-01-09[FIX] web: adapt new test introduced by previous forward-portChristophe Simonis
2018-01-09[MERGE] forward port branch saas-16 up to 4c410ee6a17Christophe Simonis
2018-01-05[FIX] web: speed resequence up in x2mChristophe Matthieu
Resequencing a x2m is very slow because the view is reloaded after each change instead of only once after all the changes.
2018-01-05[FIX] web: add a stableSort method for sorting x2mChristophe Matthieu
Issue: create 60 lines in ordered x2many with the same value (0) for the order field and make a change ; the displayed records will be switched. The problem appears because the sorting function is not stable and the records with the same values can change place (hence change page), which is quite disturbing for the user.
2018-01-05[FIX] web: sort and onchange in tabbed editable x2mChristophe Matthieu
Two attempts of dealing with sorting (and resequencing) in tabbed (multi-pages) x2many editable lists (see odoo/odoo@c2563db and odoo/odoo@983c7ae) have been previously done, using a static attribute (`keepChangesUnsorted`) on the datapoint. This solution sadly only covers both cases separately, not if they are combined. Morever, onchanges were not correctly managed in neither of these two cases. A new approach is used here, by "freezing" and "unfreezing" the datapoint when needed, which is more flexible. Some modifications have been introduced: - when ordering a x2many, all records are now considered (and not only the records on the current page) ; an additional read is thus done on the sorted field for all records in the x2many relation - `setSort` is now asynchronous as a `read` might be needed