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
Amer
erp5
Commits
d8fe72b5
Commit
d8fe72b5
authored
May 17, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: Stop using *_expression catalog arguments.
These are a bit more complex, there are more to come.
parent
c208c12d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
37 deletions
+27
-37
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedContributionList.py
...ins/erp5_base/Person_getPersonDetailedContributionList.py
+2
-4
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedReportSectionList.py
...ns/erp5_base/Person_getPersonDetailedReportSectionList.py
+5
-5
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_statPersonDetailedContributionList.py
...ns/erp5_base/Person_statPersonDetailedContributionList.py
+2
-4
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
...portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
+8
-11
bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.py
.../erp5_registry_ohada/PersonModule_getBestCandidateList.py
+8
-8
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.py
...ins/erp5_trade/OrderModule_getOrderReportParameterDict.py
+2
-5
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedContributionList.py
View file @
d8fe72b5
...
...
@@ -47,15 +47,13 @@ elif to_date is not None:
'range'
:
'max'
,
'query'
:
to_date
,
}
select_expression
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
:
None
}
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
]
# count number of object created by the user for each type of document
reference
=
kw
.
get
(
'person_reference_list'
,
context
.
Person_getUserId
())
result_list
=
context
.
portal_catalog
.
countResults
(
select_
expression
=
select_expression
,
result_list
=
context
.
portal_catalog
.
countResults
(
select_
dict
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
:
None
}
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
reference
,
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
]
,
**
count_kw
)
# build result dict per portal_type then period
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedReportSectionList.py
View file @
d8fe72b5
...
...
@@ -33,11 +33,11 @@ if context.Person_getUserId() not in (None, ""):
selection_columns
=
[(
'document_type'
,
"Document Type"
)]
if
from_date
is
None
:
# get the minimum creation date in catalog
select_expression
=
"MIN(creation_date)"
group_by
=
"creation_date"
from_date
=
DateTime
(
context
.
portal_catalog
(
select_expression
=
select_expression
,
group_by_expression
=
group_by
,
limit
=
1
)[
0
][
2
])
from_date
=
context
.
portal_catalog
(
select_list
=
[
'creation_date'
],
sort_on
=
[[
'creation_date'
,
'ASC'
]]
,
limit
=
1
,
)[
0
].
creation_date
# get period list between given date
interval_list_dict
=
getIntervalListBetweenDates
(
from_date
=
from_date
,
to_date
=
to_date
,
keys
=
{
'year'
:
aggregation_level
==
"year"
,
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_statPersonDetailedContributionList.py
View file @
d8fe72b5
...
...
@@ -47,14 +47,12 @@ elif to_date is not None:
'range'
:
'ngt'
,
'query'
:
to_date
,
}
select_expression
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
}
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,]
# count number of object created by the user for each type of document
result_list
=
context
.
portal_catalog
.
countResults
(
select_
expression
=
select_expression
,
result_list
=
context
.
portal_catalog
.
countResults
(
select_
dict
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
}
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
context
.
Person_getUserId
(),
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
]
,
**
count_kw
)
# build result dict per portal_type then period
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
View file @
d8fe72b5
...
...
@@ -9,6 +9,7 @@
- if requested, filters result so that only the user's docs are returned
- if requested, filters result to return only the newest versions
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
portal
=
context
.
getPortalObject
()
query_kw
=
{}
...
...
@@ -49,25 +50,21 @@ for key in ('reference', 'version', 'language',):
if
value
is
not
None
:
query_kw
[
key
]
=
value
where_expression
_list
=
[]
query
_list
=
[]
creation_from
=
parsed_search_string
.
get
(
'creation_from'
,
None
)
creation_to
=
parsed_search_string
.
get
(
'creation_to'
,
None
)
modification_from
=
parsed_search_string
.
get
(
'modification_from'
,
None
)
modification_to
=
parsed_search_string
.
get
(
'modification_to'
,
None
)
if
creation_from
:
where_expression_list
.
append
(
'catalog.creation_date >= "%s"'
\
%
creation_from
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_from
.
strftime
(
'>='
+
date_format
)))
if
creation_to
:
where_expression_list
.
append
(
'catalog.creation_date <= "%s"'
\
%
creation_to
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_to
.
strftime
(
'<='
+
date_format
)))
if
modification_from
:
where_expression_list
.
append
(
'catalog.modification_date >= "%s"'
\
%
modification_from
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_from
.
strftime
(
'>='
+
date_format
)))
if
modification_to
:
where_expression_list
.
append
(
'catalog.modification_date <= "%s"'
\
%
modification_to
.
strftime
(
date_format
))
if
len
(
where_expression_list
):
query_kw
[
'where_expression'
]
=
' AND '
.
join
(
where_expression_list
)
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_to
.
strftime
(
'<='
+
date_format
)))
if
query_list
:
query_kw
[
'query'
]
=
ComplexQuery
(
query_list
,
logical_operator
=
'and'
)
if
parsed_search_string
.
get
(
'mine'
,
None
)
is
not
None
:
# user wants only his documents
...
...
bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.py
View file @
d8fe72b5
...
...
@@ -79,18 +79,18 @@ else:
Query
(
birth_date
=
[
DateTime
(
person_start_date
.
year
(),
1
,
1
),
DateTime
(
person_start_date
.
year
(),
12
,
31
),],
range
=
'minmax'
),
logical_operator
=
"AND"
),
logical_operator
=
"OR"
)
select_expression
=
\
"""((title ="%s"))AS result_order
"""
%
(
person_title
)
#select_expression = \
#"""((title ="%s") + (start_date ="%s") + (birthplace_city ="%s"))AS result_order
#""" % (person_title, person_start_date, person_birthplace)
candidate_list
=
context
.
portal_catalog
(
portal_type
=
'Person'
,
query
=
query
,
select_expression
=
select_expression
,
sort_on
=
((
'result_order'
,
'DESC'
,
'int'
),),
select_expression_key
=
'result_order'
)
candidate_list
=
sorted
(
context
.
portal_catalog
(
portal_type
=
'Person'
,
query
=
query
,
select_list
=
[
'title'
],
),
key
=
lambda
x
:
x
.
title
==
person_title
)
for
candidate
in
candidate_list
:
candidate_first_name
=
candidate
.
getFirstName
()
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.py
View file @
d8fe72b5
...
...
@@ -37,18 +37,15 @@ if from_date is None:
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
kw
=
{
"delivery.start_date"
:
None
,
"key"
:
"DefaultKey"
}
q
=
NegatedQuery
(
Query
(
**
kw
))
select_expression
=
"MIN(delivery.start_date)"
group_by
=
"delivery.start_date"
from_date
=
DateTime
()
result_list
=
context
.
portal_catalog
(
select_expression
=
select_expression
,
group_by_expression
=
group_by
,
select_dict
=
{
'start_date'
:
'delivery.start_date'
},
simulation_state
=
simulation_state
,
portal_type
=
doc_portal_type
,
query
=
q
,
limit
=
1
)
if
result_list
:
from_date
=
DateTime
(
result_list
[
0
]
[
2
]
)
from_date
=
DateTime
(
result_list
[
0
]
.
start_date
)
# get period list between given date
...
...
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