Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Léo-Paul Géneau
slapos.core
Commits
be2c22f9
Commit
be2c22f9
authored
Dec 14, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent useless portal_catalog calls.
Fetching 1 element is faster than counting all.
parent
c3bcb095
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getOpenSaleOrderDifference.xml
...s/slapos_accounting/Person_getOpenSaleOrderDifference.xml
+10
-7
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getOpenSaleOrderDifference.xml
View file @
be2c22f9
...
...
@@ -73,13 +73,16 @@ now = DateTime()\n
add_kw_kw = {}\n
for add_kw in add_kw_list:\n
hosting_url = add_kw[\'aggregate\']\n
existing = portal.portal_catalog.countResults(\n
portal_type=\'Open Sale Order Line\',\n
default_aggregate_uid=portal.restrictedTraverse(hosting_url).getUid()\n
)[0][0] >
0\n
if hosting_url not in hosting_subscription_mapping and not existing:\n
add_kw_kw[hosting_url] = add_kw.copy()\n
add_kw_kw[hosting_url][\'explanation\'] = [\'Added because of %s \' % hosting_url]\n
if hosting_url not in hosting_subscription_mapping:\n
existing = len(portal.portal_catalog(\n
portal_type=\'Open Sale Order Line\',\n
default_aggregate_uid=portal.restrictedTraverse(hosting_url).getUid(),\n
limit=1,\n
)) >
0\n
if not existing:\n
# Hosting Subscription has never been related to any open order\n
add_kw_kw[hosting_url] = add_kw.copy()\n
add_kw_kw[hosting_url][\'explanation\'] = [\'Added because of %s \' % hosting_url]\n
\n
modify_kw_kw = {}\n
for hosting_url, start_date in start_date_tuple_list:\n
...
...
master/bt5/slapos_accounting/bt/revision
View file @
be2c22f9
226
\ No newline at end of file
227
\ No newline at end of file
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