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
f86e2a9f1516
Commit
f86e2a9f1516
authored
10 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
usable_per_company -> disabled_per_company
parent
6ba4bbed54f8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MetaAnalytic.py
+1
-1
1 addition, 1 deletion
MetaAnalytic.py
analytic_code.py
+21
-17
21 additions, 17 deletions
analytic_code.py
analytic_views.xml
+2
-2
2 additions, 2 deletions
analytic_views.xml
with
24 additions
and
20 deletions
MetaAnalytic.py
+
1
−
1
View file @
f86e2a9f
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
domain
=
[
domain
=
[
(
domain_field
,
'
=
'
,
model_name
),
(
domain_field
,
'
=
'
,
model_name
),
(
'
view_type
'
,
'
=
'
,
False
),
(
'
view_type
'
,
'
=
'
,
False
),
(
'
u
sable_per_company
'
,
'
=
'
,
Tru
e
),
(
'
di
sable
d
_per_company
'
,
'
=
'
,
Fals
e
),
],
],
track_visibility
=
'
onchange
'
,
track_visibility
=
'
onchange
'
,
)
)
...
...
This diff is collapsed.
Click to expand it.
analytic_code.py
+
21
−
17
View file @
f86e2a9f
...
@@ -31,6 +31,6 @@
...
@@ -31,6 +31,6 @@
_parent_order
=
'
name
'
_parent_order
=
'
name
'
_order
=
'
parent_left
'
_order
=
'
parent_left
'
def
_read_
u
sable_per_company
(
def
_read_
di
sable
d
_per_company
(
self
,
cr
,
uid
,
ids
,
field_name
,
arg
,
context
self
,
cr
,
uid
,
ids
,
field_name
,
arg
,
context
):
):
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
self
,
cr
,
uid
,
ids
,
field_name
,
arg
,
context
self
,
cr
,
uid
,
ids
,
field_name
,
arg
,
context
):
):
"""
Mark the code as
u
sable when it is
not
in the blacklist (depending
"""
Mark the code as
di
sable
d
when it is in the blacklist (depending
on
on
the current user
'
s company).
the current user
'
s company).
"""
"""
anc_obj
=
self
.
pool
[
'
analytic.code
'
]
anc_obj
=
self
.
pool
[
'
analytic.code
'
]
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
for
anc
in
anc_obj
.
browse
(
cr
,
uid
,
ids
,
context
=
context
):
for
anc
in
anc_obj
.
browse
(
cr
,
uid
,
ids
,
context
=
context
):
blacklist
=
(
company
.
id
for
company
in
anc
.
blacklist_ids
)
blacklist
=
(
company
.
id
for
company
in
anc
.
blacklist_ids
)
ret
[
anc
.
id
]
=
company_id
not
in
blacklist
ret
[
anc
.
id
]
=
company_id
in
blacklist
return
ret
return
ret
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
return
ret
return
ret
def
_write_
u
sable_per_company
(
def
_write_
di
sable
d
_per_company
(
self
,
cr
,
uid
,
anc_id
,
field_name
,
field_value
,
arg
,
context
self
,
cr
,
uid
,
anc_id
,
field_name
,
field_value
,
arg
,
context
):
):
"""
Update the blacklist depending on the current user
'
s company.
"""
Update the blacklist depending on the current user
'
s company.
...
@@ -70,5 +70,7 @@
...
@@ -70,5 +70,7 @@
blacklist
=
(
company
.
id
for
company
in
anc
.
blacklist_ids
)
blacklist
=
(
company
.
id
for
company
in
anc
.
blacklist_ids
)
to_write
=
None
to_write
=
None
if
field_value
and
company_id
in
blacklist
:
if
field_value
and
company_id
not
in
blacklist
:
to_write
=
[(
4
,
company_id
)]
# Link.
elif
not
field_value
and
company_id
in
blacklist
:
to_write
=
[(
3
,
company_id
)]
# Unlink.
to_write
=
[(
3
,
company_id
)]
# Unlink.
...
@@ -74,6 +76,4 @@
...
@@ -74,6 +76,4 @@
to_write
=
[(
3
,
company_id
)]
# Unlink.
to_write
=
[(
3
,
company_id
)]
# Unlink.
elif
not
field_value
and
company_id
not
in
blacklist
:
to_write
=
[(
4
,
company_id
)]
# Link.
if
to_write
:
if
to_write
:
anc_obj
.
write
(
anc_obj
.
write
(
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
return
True
return
True
def
_search_
u
sable_per_company
(
def
_search_
di
sable
d
_per_company
(
self
,
cr
,
uid
,
model_again
,
field_name
,
criterion
,
context
self
,
cr
,
uid
,
model_again
,
field_name
,
criterion
,
context
):
):
"""
Update the domain to take the blacklist into account (depending on
"""
Update the domain to take the blacklist into account (depending on
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
cr
,
uid
,
[
uid
],
[
'
company_id
'
],
context
=
context
cr
,
uid
,
[
uid
],
[
'
company_id
'
],
context
=
context
)[
0
][
'
company_id
'
][
0
]
)[
0
][
'
company_id
'
][
0
]
# We assume the criterion was "
u
sable_per_company =
Tru
e".
# We assume the criterion was "
di
sable
d
_per_company =
Fals
e".
return
[
return
[
'
|
'
,
'
|
'
,
(
'
blacklist_ids
'
,
'
=
'
,
False
),
(
'
blacklist_ids
'
,
'
=
'
,
False
),
...
@@ -137,9 +137,9 @@
...
@@ -137,9 +137,9 @@
u
"
Blacklist
"
,
u
"
Blacklist
"
,
help
=
u
"
Companies the code is hidden in.
"
,
help
=
u
"
Companies the code is hidden in.
"
,
),
),
'
u
sable_per_company
'
:
fields
.
function
(
'
di
sable
d
_per_company
'
:
fields
.
function
(
_read_
u
sable_per_company
,
_read_
di
sable
d
_per_company
,
fnct_inv
=
_write_
u
sable_per_company
,
fnct_inv
=
_write_
di
sable
d
_per_company
,
fnct_search
=
_search_
u
sable_per_company
,
fnct_search
=
_search_
di
sable
d
_per_company
,
method
=
True
,
method
=
True
,
type
=
'
boolean
'
,
type
=
'
boolean
'
,
...
@@ -144,7 +144,11 @@
...
@@ -144,7 +144,11 @@
method
=
True
,
method
=
True
,
type
=
'
boolean
'
,
type
=
'
boolean
'
,
store
=
False
,
# Not persistent as it dpeends on the company.
store
=
False
,
# Not persistent as it depends on the company.
string
=
u
"
Usable in my company
"
,
string
=
u
"
Disabled in my company
"
,
help
=
(
u
"
Determines whether an analytic code is disabled for the
"
u
"
current company.
"
),
),
),
'
nd_name
'
:
fields
.
related
(
'
nd_name
'
:
fields
.
related
(
...
@@ -177,7 +181,7 @@
...
@@ -177,7 +181,7 @@
_defaults
=
{
_defaults
=
{
'
active
'
:
lambda
*
a
:
True
,
'
active
'
:
lambda
*
a
:
True
,
'
view_type
'
:
lambda
*
a
:
False
,
'
view_type
'
:
lambda
*
a
:
False
,
'
u
sable_per_company
'
:
lambda
*
a
:
Tru
e
,
'
di
sable
d
_per_company
'
:
lambda
*
a
:
Fals
e
,
}
}
_constraints
=
[
_constraints
=
[
...
...
This diff is collapsed.
Click to expand it.
analytic_views.xml
+
2
−
2
View file @
f86e2a9f
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<field
name=
"id"
invisible=
"1"
/>
<field
name=
"id"
invisible=
"1"
/>
<field
name=
"active"
/>
<field
name=
"active"
/>
<field
name=
"view_type"
invisible=
"1"
/>
<field
name=
"view_type"
invisible=
"1"
/>
<field
name=
"
u
sable_per_company"
/>
<field
name=
"
di
sable
d
_per_company"
/>
<field
name=
"name"
/>
<field
name=
"name"
/>
<field
name=
"description"
/>
<field
name=
"description"
/>
<field
name=
"nd_id"
<field
name=
"nd_id"
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<group>
<group>
<field
name=
"active"
/>
<field
name=
"active"
/>
<field
name=
"view_type"
invisible=
"1"
/>
<field
name=
"view_type"
invisible=
"1"
/>
<field
name=
"
u
sable_per_company"
/>
<field
name=
"
di
sable
d
_per_company"
/>
</group>
</group>
<group
colspan=
"2"
>
<group
colspan=
"2"
>
...
...
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