[FIX] board: not crash on views with domains and custom layout
Current behaviour: If you export a view with a (some) filters and you set a custom layout in the dashboard, you will get a traceback, preventing you for accessing your newly exported dashboard. Expected behaviour: Should not crash when trying to view your exported view, even with a custom domain. Steps to reproduce: - Install Dashboard, Sales - Export from Sales > List View with a filter Creation Date before XX:XX (date is irrelevant) - Go to Dashboard > My Dashboard > Change Layout to something else - Exit the page and retry to reopen it, a stacktrace is shown. Reason for the problem: When preprocessing the arch of the view in the dashboard, which is an xml string, there is the domain included, which contains symbols that are unparsable by `etree` unless escaped (like `<`). Fix: Escape the domain client side before being sent and saved in the database, so when requesting it we don't have a parsing error. Then we unescape it when the clients reads the domain from the server. The unescaping before escaping is to avoid problem of double escaping when changing subsequently the layout of the board view. Affected versions: - 16.0 - saas-16.1 - master opw-3130117 closes odoo/odoo#112334 X-original-commit: bfadb8e491fe2acda63a79f9577eaaec8a1c8d9c Signed-off-by: Géry Debongnie <ged@odoo.com> Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
@@ -45,9 +45,10 @@ export class BoardArchParser extends XMLParser {
|
||||
isFolded,
|
||||
};
|
||||
if (node.hasAttribute("domain")) {
|
||||
action.domain = new Domain(node.getAttribute("domain")).toList();
|
||||
action.domain = new Domain(_.unescape(node.getAttribute("domain"))).toList();
|
||||
// so it can be serialized when reexporting board xml
|
||||
action.domain.toString = () => node.getAttribute("domain");
|
||||
// we unescape before re-escaping, to avoid double escaping due to subsequent layout change
|
||||
action.domain.toString = () => _.escape(_.unescape(node.getAttribute("domain")));
|
||||
}
|
||||
archInfo.columns[currentIndex].actions.push(action);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user