Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Analytic Structure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Analytic Structure
Commits
b422df8b2dfe
Commit
b422df8b2dfe
authored
5 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Fix dynamic field attributes (column_invisible)
parent
4fd3d3f64d45
No related branches found
No related tags found
1 merge request
!14
🤝 11.0-tomerge
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/analytic_structure.py
+25
-12
25 additions, 12 deletions
models/analytic_structure.py
with
25 additions
and
12 deletions
models/analytic_structure.py
+
25
−
12
View file @
b422df8b
...
...
@@ -299,7 +299,7 @@
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
"
)
...
...
@@ -345,4 +345,11 @@
)
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
"
,
"
{}
"
))
...
...
@@ -348,3 +355,12 @@
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.
for
field
in
elem_fields
:
...
...
@@ -349,16 +365,8 @@
# Now we can insert the fields in the view's architecture.
for
field
in
elem_fields
:
attrs
=
{
"
name
"
:
field
}
attrs
[
"
modifiers
"
]
=
json
.
dumps
(
{
attr
:
value
for
attr
,
value
in
list
(
modifiers
.
items
())
if
elem
.
attrib
.
get
(
attr
,
"
False
"
)
in
(
"
True
"
,
"
true
"
,
"
1
"
)
}
)
for
attr
,
value
in
list
(
elem
.
attrib
.
items
()):
if
attr
in
[
"
name
"
,
"
prefix
"
,
"
suffix
"
,
"
modifiers
"
]:
attrs
=
{
"
modifiers
"
:
modifiers
,
"
name
"
:
field
}
for
attr
,
value
in
elem
.
attrib
.
items
():
if
attr
in
(
"
name
"
,
"
prefix
"
,
"
suffix
"
,
"
modifiers
"
):
continue
attrs
[
attr
]
=
value
parent
.
append
(
etree
.
Element
(
"
field
"
,
attrs
))
...
...
@@ -368,3 +376,8 @@
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
"
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment