Skip to content
Snippets Groups Projects

:handshake: 11.0-tomerge

Open Vincent Hatakeyama requested to merge topic/11.0/merge into branch/11.0
4 files
+ 40
1
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -300,7 +300,7 @@ class AnalyticStructure(models.Model):
else:
# No analytic structure defined for this field, hide it.
modifiers = json.loads(match.get("modifiers", "{}"))
modifiers["invisible"] = modifiers["tree_invisible"] = True
modifiers["invisible"] = modifiers["column_invisible"] = True
modifiers["required"] = False
match.set("invisible", "true")
match.set("required", "false")
@@ -346,7 +346,23 @@ class AnalyticStructure(models.Model):
)
view["fields"].update(elem_fields_def)
# Prepare the "modifiers" attribute normally dynamically added.
# Specifics here:
# * We compare against explicit attributes in the view. This
# way we avoid all-read-only fields as the main
# "analytic_dimensions" pseudo-field is read-only.
# * When comparing, handle column_invisible -> invisible (see
# odoo/osv/orm.py > transfer_node_to_modifiers).
modifiers = json.loads(elem.attrib.get("modifiers", "{}"))
modifiers = json.dumps(
{
attr: value
for attr, value in modifiers.items()
if elem.attrib.get(_MODIFIER_TO_ATTR.get(attr, attr))
in ("True", "true", "1")
}
)
# Now we can insert the fields in the view's architecture.
model_map = {
@@ -382,3 +398,8 @@ class AnalyticStructure(models.Model):
view["arch"] = etree.tostring(doc)
return view
# Used above in analytic_fields_view_get to compare "modifiers" vs explicit
# attributes. See odoo/osv/orm.py > transfer_node_to_modifiers.
_MODIFIER_TO_ATTR = {"column_invisible": "invisible"}
Loading