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
Carlos Ramos Carreño
erp5
Commits
8aa30153
Commit
8aa30153
authored
Mar 25, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly use Query instances instead of SQL hacks
parent
d54ccfbc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
product/ERP5/Document/Document.py
product/ERP5/Document/Document.py
+4
-3
No files found.
product/ERP5/Document/Document.py
View file @
8aa30153
...
...
@@ -45,7 +45,7 @@ from Products.ERP5Type.Utils import convertToUpperCase, fill_args_from_request,\
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.Cache
import
getReadOnlyTransactionCache
from
Products.ERP5.Tool.ContributionTool
import
MAX_REPEAT
from
Products.ZSQLCatalog.SQLCatalog
import
SQL
Query
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
Negated
Query
from
AccessControl
import
Unauthorized
import
zope.interface
from
Products.PythonScripts.Utility
import
allow_class
...
...
@@ -542,7 +542,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
reference=self.getReference(),
version=self.getVersion(),
language=self.getLanguage(),
validation_state="!=cancelled"
)
query=NegatedQuery(Query(validation_state=('cancelled', 'deleted')))
)
catalog = self.getPortalObject().portal_catalog
self_count = catalog.unrestrictedCountResults(uid=self.getUid(), **kw)[0][0]
count = catalog.unrestrictedCountResults(**kw)[0][0]
...
...
@@ -600,8 +600,9 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
# Find all document with same (reference, version, language)
kw = dict(portal_type=self.getPortalType(),
reference=self.getReference(),
where_expression=SQLQuery("validation_state NOT IN ('archived', 'cancelled', 'deleted')"
),
query=NegatedQuery(Query(validation_state=invalid_validation_state_list)
),
sort_on='creation_date')
if self.getVersion():
kw['version'] = self.getVersion()
if self.getLanguage():
...
...
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