[FIX] web: list: tolerate editable"1" (only in stable)
A few x2many list embedded in form views have the "editable" attr set to "1". Normally, the valid values for this attribute are "top" and "bottom". Regular list views are validated, but not lists inside form views. When set to "1", some features of the model aren't enabled. For instance, when the current page is full and the user adds a record, the limit isn't temporarilly increased for the added record to be displayed on the current page, like it would be in editable="bottom" lists, so the user doesn't see the record he just added. The issue can be observed in the stock move form view for instance. This commit is only good for stable versions: we add a fallback on "bottom" s.t. if the editable attribute is set, it's always either "top" or "bottom". In master, we'll probably rethink the API. opw~3860903 closes odoo/odoo#162832 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
@@ -183,7 +183,15 @@ export class ListArchParser {
|
||||
treeAttr.activeActions = activeActions;
|
||||
|
||||
treeAttr.className = xmlDoc.getAttribute("class") || null;
|
||||
treeAttr.editable = xmlDoc.getAttribute("editable");
|
||||
let editableAttr = xmlDoc.getAttribute("editable");
|
||||
// FIXME: supported values for the editable attribute are normally "top"/"bottom".
|
||||
// However, form views aren't validated, and a few x2many list have editable="1".
|
||||
// In master, we'll throw to enforce valid values, but in 17, let's fallback on
|
||||
// "bottom".
|
||||
if (editableAttr && !["top", "bottom"].includes(editableAttr)) {
|
||||
editableAttr = archParseBoolean(editableAttr) ? "bottom" : null;
|
||||
}
|
||||
treeAttr.editable = editableAttr;
|
||||
treeAttr.multiEdit = activeActions.edit
|
||||
? archParseBoolean(node.getAttribute("multi_edit") || "")
|
||||
: false;
|
||||
|
||||
Reference in New Issue
Block a user