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
Mikolaï Krol
erp5
Commits
5f90432b
Commit
5f90432b
authored
Aug 30, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce number of JOIN
parent
c397c3f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
25 deletions
+30
-25
product/ERP5/Tool/AcknowledgementTool.py
product/ERP5/Tool/AcknowledgementTool.py
+30
-25
No files found.
product/ERP5/Tool/AcknowledgementTool.py
View file @
5f90432b
...
@@ -116,31 +116,36 @@ class AcknowledgementTool(BaseTool):
...
@@ -116,31 +116,36 @@ class AcknowledgementTool(BaseTool):
document_list
=
[]
document_list
=
[]
if
user_name
is
not
None
:
if
user_name
is
not
None
:
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
now
=
DateTime
()
person_value
=
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
# First look at all event that define the current user as destination
user_name
=
user_name
)
all_document_list
=
[
x
for
x
in
\
if
person_value
is
None
:
self
.
portal_catalog
(
portal_type
=
portal_type
,
raise
ValueError
(
'No user found'
)
simulation_state
=
self
.
getPortalTransitInventoryStateList
(),
else
:
# start_date = {'query':now,'range':'max'},
now
=
DateTime
()
# stop_date = {'query':now,'range':'min'},
# First look at all event that define the current user as destination
default_destination_reference
=
user_name
)]
all_document_list
=
[
x
for
x
in
\
# Now we can look directly at acknowledgement document not approved yet
self
.
portal_catalog
(
portal_type
=
portal_type
,
# so not in a final state
simulation_state
=
self
.
getPortalTransitInventoryStateList
(),
final_state_list
=
self
.
getPortalCurrentInventoryStateList
()
# start_date = {'query':now,'range':'max'},
query
=
NegatedQuery
(
Query
(
simulation_state
=
final_state_list
))
# stop_date = {'query':now,'range':'min'},
all_document_list
.
extend
([
x
for
x
in
\
default_destination_uid
=
person_value
.
getUid
())]
self
.
portal_catalog
(
portal_type
=
portal_type
,
# Now we can look directly at acknowledgement document not approved yet
query
=
query
,
# so not in a final state
# start_date = {'query':now,'range':'max'},
final_state_list
=
self
.
getPortalCurrentInventoryStateList
()
# stop_date = {'query':now,'range':'min'},
query
=
NegatedQuery
(
Query
(
simulation_state
=
final_state_list
))
destination_reference
=
user_name
)])
all_document_list
.
extend
([
x
for
x
in
\
for
document
in
all_document_list
:
self
.
portal_catalog
(
portal_type
=
portal_type
,
# We filter manually on dates until a good solution is found for
query
=
query
,
# searching by dates on the catalog
# start_date = {'query':now,'range':'max'},
if
(
document
.
getStartDate
()
<
now
<
(
document
.
getStopDate
()
+
1
)):
# stop_date = {'query':now,'range':'min'},
acknowledged
=
document
.
isAcknowledged
(
user_name
=
user_name
)
default_destination_uid
=
person_value
.
getUid
())])
if
not
acknowledged
:
for
document
in
all_document_list
:
document_list
.
append
(
document
.
getRelativeUrl
())
# We filter manually on dates until a good solution is found for
# searching by dates on the catalog
if
(
document
.
getStartDate
()
<
now
<
(
document
.
getStopDate
()
+
1
)):
acknowledged
=
document
.
isAcknowledged
(
user_name
=
user_name
)
if
not
acknowledged
:
document_list
.
append
(
document
.
getRelativeUrl
())
else
:
else
:
raise
ValueError
(
'No user name given'
)
raise
ValueError
(
'No user name given'
)
return
document_list
return
document_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