[IMP] base: add widget in tree view rng validation

Before this commit, it was possible to define a <widget/> in the arch of
an x2many in list mode. But this was not supported in normal list views.

So in order to unify the api, we decided to support in the list
view as well.

In a future commit, we plan to improve the widget api to receive only
the necessary props.

closes odoo/odoo#107811

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
FrancoisGe
2022-12-13 13:51:48 +01:00
parent 990cce2b1b
commit c82cb3b5cd
4 changed files with 14 additions and 1 deletions
@@ -135,7 +135,7 @@ export class ListArchParser extends XMLParser {
// FIXME: this is dumb, we encode it into a weird object so that the widget
// can decode it later...
node: encodeObjectForTemplate({ attrs: widgetInfo.rawAttrs }).slice(1, -1),
className: node.getAttribute("class"),
className: node.getAttribute("class") || "",
};
columns.push({
...widgetInfo,
@@ -3,4 +3,9 @@
export const standardWidgetProps = {
readonly: { type: Boolean, optional: true },
record: { type: Object },
// TODO TO REMOVE - ListView - FGE
options: { type: Object, optional: true },
rawAttrs: { type: Object, optional: true },
WidgetComponent: { type: Function, optional: true },
className: { type: String, optional: true },
};
+7
View File
@@ -432,4 +432,11 @@
</rng:element>
</rng:define>
<rng:define name="widget">
<rng:element name="widget">
<rng:attribute name="name"/>
<rng:optional><rng:attribute name="options"/></rng:optional>
</rng:element>
</rng:define>
</rng:grammar>
+1
View File
@@ -76,6 +76,7 @@
</rng:element>
<rng:ref name="control"/>
<rng:ref name="field"/>
<rng:ref name="widget"/>
<rng:ref name="separator"/>
<rng:ref name="tree"/>
<rng:ref name="groupby"/>