[FIX] web: send correct filter's context when saving filter

Before this commit, the context coming from the action was
merged with the context of the search items to generate the
context of the filter to save, when the user clicked on "Save
current search", whereas it should not.

There is an ActionService test attesting it, but it currently
uses a ListView, which is still legacy, so the new faulty code
wasn't tested.

closes odoo/odoo#81049

X-original-commit: 2d76b33142cf2bf451d4730c035af75c3243da6f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2021-12-08 12:52:29 +00:00
parent bfa7d28a8e
commit c171ebb054
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -407,7 +407,7 @@ export class SearchModel extends EventBus {
*/
get context() {
if (!this._context) {
this._context = this._getContext();
this._context = makeContext([this._getContext(), this.globalContext]);
}
return deepCopy(this._context);
}
@@ -1325,7 +1325,7 @@ export class SearchModel extends EventBus {
*/
_getContext() {
const groups = this._getGroups();
const contexts = [this.userService.context, this.globalContext];
const contexts = [this.userService.context];
for (const group of groups) {
for (const activeItem of group.activeItems) {
const context = this._getSearchItemContext(activeItem);
@@ -181,6 +181,7 @@ QUnit.module("Search", (hooks) => {
}
},
resModel: "foo",
context: { someOtherKey: "bar" }, // should not end up in filter's context
Component: TestComponent,
searchViewId: false,
});