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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
70be507a
Commit
70be507a
authored
Jul 20, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OrderMovementGroup: small optimization (fixing wrong use of hasattr)
parent
96af08af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
product/ERP5/Document/OrderMovementGroup.py
product/ERP5/Document/OrderMovementGroup.py
+11
-17
No files found.
product/ERP5/Document/OrderMovementGroup.py
View file @
70be507a
...
...
@@ -39,10 +39,7 @@ class OrderMovementGroup(MovementGroup):
portal_type
=
'Order Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
order_relative_url
=
self
.
_getOrderRelativeUrl
(
movement
)
property_dict
[
'causality_list'
]
=
[
order_relative_url
]
return
property_dict
return
{
'causality_list'
:
[
self
.
_getOrderRelativeUrl
(
movement
)]}
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
if
set
(
property_dict
[
'causality_list'
]).
issubset
(
movement
.
getCausalityList
()):
...
...
@@ -52,16 +49,13 @@ class OrderMovementGroup(MovementGroup):
return
False
,
property_dict
def
_getOrderRelativeUrl
(
self
,
movement
):
if
hasattr
(
movement
,
'getRootAppliedRule'
):
# This is a simulation movement
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
portal_type
=
movement
.
getPortalOrderTypeList
())
if
order_relative_url
is
None
:
# In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
portal_type
=
movement
.
getPortalDeliveryTypeList
())
else
:
# This is a temp movement
order_relative_url
=
None
return
order_relative_url
try
:
getRootAppliedRule
=
movement
.
getRootAppliedRule
except
AttributeError
:
return
# This is a temp movement
# This is a simulation movement
getCausality
=
getRootAppliedRule
().
getCausality
return
(
getCausality
(
portal_type
=
movement
.
getPortalOrderTypeList
())
or
# In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup
getCausality
(
portal_type
=
movement
.
getPortalDeliveryTypeList
()))
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