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
Eteri
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):
...
@@ -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
:
# This is a simulation movement
getRootAppliedRule
=
movement
.
getRootAppliedRule
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
except
AttributeError
:
portal_type
=
movement
.
getPortalOrderTypeList
())
return
# This is a temp movement
if
order_relative_url
is
None
:
# This is a simulation movement
# In some cases (ex. DeliveryRule), there is no order
getCausality
=
getRootAppliedRule
().
getCausality
# we may consider a PackingList as the order in the OrderGroup
return
(
getCausality
(
portal_type
=
movement
.
getPortalOrderTypeList
())
or
order_relative_url
=
movement
.
getRootAppliedRule
().
getCausality
(
# In some cases (ex. DeliveryRule), there is no order
portal_type
=
movement
.
getPortalDeliveryTypeList
())
# we may consider a PackingList as the order in the OrderGroup
else
:
getCausality
(
portal_type
=
movement
.
getPortalDeliveryTypeList
()))
# 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