Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
erp5
Commits
bd3045fb
Commit
bd3045fb
authored
Nov 18, 2013
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend method to be possible filter constraint by contraint_type
parent
4fb1fbc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+10
-2
No files found.
product/ERP5Type/Base.py
View file @
bd3045fb
...
@@ -2590,7 +2590,7 @@ class Base( CopyContainer,
...
@@ -2590,7 +2590,7 @@ class Base( CopyContainer,
"""
"""
Returns a list of constraints filtered by filt argument.
Returns a list of constraints filtered by filt argument.
"""
"""
# currently only 'id' and 'reference' are supported.
# currently only 'id' and 'reference'
, 'constraint_type'
are supported.
constraints
=
self
.
constraints
constraints
=
self
.
constraints
if
filt
is
not
None
:
if
filt
is
not
None
:
if
'id'
in
filt
:
if
'id'
in
filt
:
...
@@ -2603,7 +2603,15 @@ class Base( CopyContainer,
...
@@ -2603,7 +2603,15 @@ class Base( CopyContainer,
reference_list
=
filt
.
get
(
'reference'
,
None
)
reference_list
=
filt
.
get
(
'reference'
,
None
)
if
not
isinstance
(
reference_list
,
(
list
,
tuple
)):
if
not
isinstance
(
reference_list
,
(
list
,
tuple
)):
reference_list
=
[
reference_list
]
reference_list
=
[
reference_list
]
constraints
=
filter
(
lambda
x
:
x
.
getProperty
(
'reference'
)
in
reference_list
,
constraints
)
constraints
=
filter
(
lambda
x
:
x
.
getProperty
(
'reference'
)
in
\
reference_list
,
constraints
)
if
'constraint_type'
in
filt
:
constraint_type_list
=
filt
.
get
(
'constraint_type'
,
None
)
if
not
isinstance
(
constraint_type_list
,
(
list
,
tuple
)):
constraint_type_list
=
[
constraint_type_list
]
constraints
=
filter
(
lambda
x
:
x
.
__of__
(
self
).
getProperty
(
'constraint_type'
)
in
\
constraint_type_list
,
constraints
)
return
constraints
return
constraints
# Context related methods
# Context related methods
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment