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
Léo-Paul Géneau
erp5
Commits
036f0c50
Commit
036f0c50
authored
Nov 15, 2024
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Plain Diff
Stock view optimization
See merge request
nexedi/erp5!2017
parents
43b37458
d1c141da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
4 deletions
+50
-4
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getFutureInventoryList.py
.../portal_skins/erp5_pdm/Resource_getFutureInventoryList.py
+25
-2
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_statInventory.py
...plateItem/portal_skins/erp5_pdm/Resource_statInventory.py
+25
-2
No files found.
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getFutureInventoryList.py
View file @
036f0c50
...
...
@@ -9,10 +9,33 @@ inventory_list_kw = {
'resource_uid'
:
context
.
getUid
(),
}
# By passing node_uid and section_uid instead of node_category and
# section_category, we bypass 2 joins on category tables, and can
# directly use a good index:
# `resource_section_node_uid` (`resource_uid`,`section_uid`,`node_uid`,`simulation_state`)
# So it's better to run 2 catalog queries to retrieve the uid
# of the Organisations beforehand instead of confusing the catalog
# and making it go through huge joins (where no index can be used)
if
node_category
:
inventory_list_kw
[
'node_category'
]
=
node_category
node_uid_list
=
[
x
.
uid
for
x
in
portal
.
portal_catalog
(
portal_type
=
portal
.
getPortalNodeTypeList
(),
default_site_uid
=
portal
.
portal_categories
.
resolveCategory
(
node_category
).
getUid
(),
)
]
if
not
node_uid_list
:
return
[]
inventory_list_kw
[
"node_uid"
]
=
node_uid_list
if
section_category
:
inventory_list_kw
[
'section_category'
]
=
section_category
section_uid_list
=
[
x
.
uid
for
x
in
portal
.
portal_catalog
(
portal_type
=
portal
.
getPortalNodeTypeList
(),
default_group_uid
=
portal
.
portal_categories
.
resolveCategory
(
section_category
).
getUid
(),
)
]
if
not
section_uid_list
:
return
[]
inventory_list_kw
[
'section_uid'
]
=
section_uid_list
if
quantity_unit
:
inventory_list_kw
[
'quantity_unit'
]
=
quantity_unit
if
metric_type
:
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_statInventory.py
View file @
036f0c50
from
Products.PythonScripts.standard
import
Object
portal
=
context
.
getPortalObject
()
inventory_kw
=
{
'selection_domain'
:
selection_domain
}
# See Resource_getFutureInventoryList to understand why we
# run catalog queries to retrieve Organisations's uid
# instead of passing category paths to getInventory
if
node_category
:
inventory_kw
[
'node_category'
]
=
node_category
node_uid_list
=
[
x
.
uid
for
x
in
portal
.
portal_catalog
(
portal_type
=
portal
.
getPortalNodeTypeList
(),
default_site_uid
=
portal
.
portal_categories
.
resolveCategory
(
node_category
).
getUid
(),
)
]
if
not
node_uid_list
:
return
[]
inventory_kw
[
"node_uid"
]
=
node_uid_list
section_uid_list
=
None
if
section_category
:
inventory_kw
[
'section_category'
]
=
section_category
section_uid_list
=
[
x
.
uid
for
x
in
portal
.
portal_catalog
(
portal_type
=
portal
.
getPortalNodeTypeList
(),
default_group_uid
=
portal
.
portal_categories
.
resolveCategory
(
section_category
).
getUid
(),
)
]
if
not
section_uid_list
:
return
[]
inventory_kw
[
'section_uid'
]
=
section_uid_list
if
quantity_unit
:
inventory_kw
[
'quantity_unit'
]
=
quantity_unit
if
metric_type
:
...
...
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