diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-07-20 07:22:33 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-07-28 13:03:13 +0000 |
| commit | c8063af7a085eda61e470fa5c861e94388429644 (patch) | |
| tree | 4138a64b383e2ee9cc50d5275d85e4fb03c2c568 /odoo/import_xml.rng | |
| parent | 6835aeb0de6895f7f4d6b23e0b4654465ef21d6a (diff) | |
[IMP] core, account, lunch: make <menuitem> recursive
For clarity, some data files are formatted as pseudo-tree
structure. This is somewhat confusing and dangerous when the structure
has no meaning... so add meaning:
* allow nesting menuitems, nested items are set as children to the
parent they're nested in
* update schema to allow an icon *or* a parent on regular menu items,
and neither on nested (they have an implicit parent meaning can't
have an icon)
* remove attributes which don't actually exist from the menuitem
schema
* also type sequence as an integer while at it
Convert two large-ish menuitem data files to recursive form.
closes odoo/odoo#54564
Related: odoo/enterprise#11887
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo/import_xml.rng')
| -rw-r--r-- | odoo/import_xml.rng | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/odoo/import_xml.rng b/odoo/import_xml.rng index 1a182ce6ffc..016f21dca8b 100644 --- a/odoo/import_xml.rng +++ b/odoo/import_xml.rng @@ -224,23 +224,42 @@ </rng:element> </rng:define> + <rng:define name="menuitem_attrs"> + <rng:attribute name="id" /> + <rng:optional><rng:attribute name="name"/></rng:optional> + <rng:optional> + <rng:attribute name="sequence"> + <rng:data type="int"/> + </rng:attribute> + </rng:optional> + <rng:optional><rng:attribute name="groups"/></rng:optional> + <rng:optional><rng:attribute name="active"/></rng:optional> + <rng:optional> + <!-- menu can't have both children and action --> + <rng:choice> + <rng:attribute name="action"/> + <rng:oneOrMore> + <rng:ref name="submenuitem"/> + </rng:oneOrMore> + </rng:choice> + </rng:optional> + </rng:define> <rng:define name="menuitem"> <rng:element name="menuitem"> - <!-- TODO: id should probably be mandatory --> - <rng:optional> <rng:attribute name="id" /></rng:optional> - <rng:optional> <rng:attribute name="name"/></rng:optional> - <rng:optional> <rng:attribute name="parent"/> </rng:optional> - <rng:optional> <rng:attribute name="action"/> </rng:optional> - <rng:optional> <rng:attribute name="sequence"/> </rng:optional> - <rng:optional> <rng:attribute name="groups"/> </rng:optional> - <rng:optional> <rng:attribute name="active"/> </rng:optional> - <!-- TODO: remove icon stuff --> - <rng:optional> <rng:attribute name="icon"/> </rng:optional> - <rng:optional> <rng:attribute name="web_icon"/> </rng:optional> - <rng:optional> <rng:attribute name="web_icon_hover"/> </rng:optional> - <!-- string doesn't seem used anywhere --> - <rng:optional> <rng:attribute name="string"/> </rng:optional> - <rng:empty /> + <rng:ref name="menuitem_attrs"/> + <rng:optional> + <rng:choice> + <!-- can't have submenus with icons --> + <rng:attribute name="parent"/> + <rng:attribute name="web_icon"/> + </rng:choice> + </rng:optional> + </rng:element> + </rng:define> + <!-- menuitem except no parent (is implicit) or web_icon attributes --> + <rng:define name="submenuitem"> + <rng:element name="menuitem"> + <rng:ref name="menuitem_attrs"/> </rng:element> </rng:define> |
