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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
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
Show 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):
...
@@ -39,10 +39,7 @@ class OrderMovementGroup(MovementGroup):
portal_type
=
'Order Movement Group'
portal_type
=
'Order Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'causality_list'
:
[
self
.
_getOrderRelativeUrl
(
movement
)]}
order_relative_url
=
self
.
_getOrderRelativeUrl
(
movement
)
property_dict
[
'causality_list'
]
=
[
order_relative_url
]
return
property_dict
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
if
set
(
property_dict
[
'causality_list'
]).
issubset
(
movement
.
getCausalityList
()):
if
set
(
property_dict
[
'causality_list'
]).
issubset
(
movement
.
getCausalityList
()):
...
@@ -52,16 +49,13 @@ class OrderMovementGroup(MovementGroup):
...
@@ -52,16 +49,13 @@ class OrderMovementGroup(MovementGroup):
return
False
,
property_dict
return
False
,
property_dict
def
_getOrderRelativeUrl
(
self
,
movement
):
def
_getOrderRelativeUrl
(
self
,
movement
):
if
hasattr
(
movement
,
'getRootAppliedRule'
):
try
:
getRootAppliedRule
=
movement
.
getRootAppliedRule
except
AttributeError
:
return
# This is a temp movement
# This is a simulation movement
# This is a simulation movement
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
getCausality
=
getRootAppliedRule
().
getCausality
portal_type
=
movement
.
getPortalOrderTypeList
())
return
(
getCausality
(
portal_type
=
movement
.
getPortalOrderTypeList
())
or
if
order_relative_url
is
None
:
# In some cases (ex. DeliveryRule), there is no order
# In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup
# we may consider a PackingList as the order in the OrderGroup
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
getCausality
(
portal_type
=
movement
.
getPortalDeliveryTypeList
()))
portal_type
=
movement
.
getPortalDeliveryTypeList
())
else
:
# This is a temp movement
order_relative_url
=
None
return
order_relative_url
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