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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
erp5
Commits
766c9a01
Commit
766c9a01
authored
Dec 13, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify Delivery.getMovementList
parent
b4b5bcf8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
52 deletions
+36
-52
product/ERP5/Document/Delivery.py
product/ERP5/Document/Delivery.py
+36
-52
No files found.
product/ERP5/Document/Delivery.py
View file @
766c9a01
...
@@ -241,58 +241,42 @@ class Delivery(XMLObject, ImmobilisationDelivery,
...
@@ -241,58 +241,42 @@ class Delivery(XMLObject, ImmobilisationDelivery,
"""
"""
Return a list of movements
Return a list of movements
"""
"""
movement_portal_type_
list
=
self
.
getPortalMovementTypeList
()
movement_portal_type_
set
=
set
(
sub_object_list
=
self
.
objectValues
(
self
.
getPortalObject
().
getPortalMovementTypeList
())
portal_type
=
movement_portal_type_list
,
**
kw
)
movement_list
=
self
.
objectValues
(
if
not
sub_object_list
:
portal_type
=
movement_portal_type_set
,
**
kw
)
return
[]
if
movement_list
:
if
isinstance
(
portal_type
,
str
):
if
isinstance
(
portal_type
,
str
):
portal_type
=
set
((
portal_type
,))
portal_type
=
set
((
portal_type
,))
elif
isinstance
(
portal_type
,
(
list
,
tuple
)):
elif
isinstance
(
portal_type
,
(
list
,
tuple
)):
portal_type
=
set
(
portal_type
)
portal_type
=
set
(
portal_type
)
# Browse lines recursively and collect leafs.
stack
=
[
iter
(
movement_list
)]
movement_list
=
[]
movement_list
=
[]
add_movement
=
movement_list
.
append
while
stack
:
object_list_stack
=
[
sub_object_list
]
for
sub_object
in
stack
[
-
1
]:
stack_index
=
0
object_list_index_stack
=
[]
object_index
=
0
while
object_list_stack
:
try
:
sub_object
=
object_list_stack
[
stack_index
][
object_index
]
except
IndexError
:
object_list_stack
.
pop
()
stack_index
-=
1
if
object_list_index_stack
:
object_index
=
object_list_index_stack
.
pop
()
else
:
content_list
=
sub_object
.
objectValues
(
content_list
=
sub_object
.
objectValues
(
portal_type
=
movement_portal_type_list
,
**
kw
)
portal_type
=
movement_portal_type_set
,
**
kw
)
new_stack
=
[]
if
sub_object
.
hasCellContent
():
if
sub_object
.
hasCellContent
():
cell_list
=
sub_object
.
getCellValueList
()
cell_list
=
sub_object
.
getCellValueList
()
if
len
(
cell_list
)
!=
len
(
content_list
):
if
len
(
cell_list
)
!=
len
(
content_list
):
for
x
in
content_list
:
content_list
=
set
(
content_list
).
difference
(
cell_list
)
if
x
not
in
cell_list
:
if
content_list
:
new_stack
.
append
(
x
)
stack
.
append
(
iter
(
content_list
))
break
else
:
else
:
for
sub_object
in
content_list
:
movement_list
.
extend
(
x
for
x
in
content_list
if
(
portal_type
is
None
or
if
portal_type
is
None
or
x
.
getPortalType
()
in
portal_type
)
sub_object
.
getPortalType
()
in
portal_type
):
add_movement
(
sub_object
)
elif
content_list
:
elif
content_list
:
new_stack
=
content_list
stack
.
append
(
iter
(
content_list
))
elif
portal_type
is
None
or
sub_object
.
getPortalType
()
in
portal_type
:
break
add_movement
(
sub_object
)
elif
portal_type
is
None
or
\
sub_object
.
getPortalType
()
in
portal_type
:
object_index
+=
1
movement_list
.
append
(
sub_object
)
if
new_stack
:
else
:
object_list_stack
.
append
(
new_stack
)
del
stack
[
-
1
]
object_list_index_stack
.
append
(
object_index
)
stack_index
+=
1
object_index
=
0
return
movement_list
return
movement_list
...
...
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