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
59f14dea
Commit
59f14dea
authored
Sep 25, 2015
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InventoryBrain: Do not use getToolByName.
Also, factorise code.
parent
7dbee586
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
22 deletions
+17
-22
product/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/portal_components/extension.erp5.InventoryBrain.py
...teItem/portal_components/extension.erp5.InventoryBrain.py
+17
-22
No files found.
product/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/portal_components/extension.erp5.InventoryBrain.py
View file @
59f14dea
...
...
@@ -52,33 +52,28 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin):
Lists each variation
"""
# Stock management
def
_callSimulationTool
(
self
,
method_id
,
**
kw
):
return
getattr
(
self
.
getPortalObject
().
portal_simulation
,
method_id
,
)(
node_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource_uid
=
self
.
resource_uid
,
**
kw
)
def
getInventory
(
self
,
**
kw
):
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getInventory
(
node_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource_uid
=
self
.
resource_uid
,
**
kw
)
def
getCurrentInventory
(
self
,
**
kw
):
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getCurrentInventory
(
node_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource_uid
=
self
.
resource_uid
,
**
kw
)
return
self
.
_callSimulationTool
(
'getInventory'
,
**
kw
)
def
getCurrentInventory
(
self
,
**
kw
):
return
self
.
_callSimulationTool
(
'getCurrentInventory'
,
**
kw
)
def
getFutureInventory
(
self
,
**
kw
):
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getFutureInventory
(
node_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource_uid
=
self
.
resource_uid
,
**
kw
)
return
self
.
_callSimulationTool
(
'getFutureInventory'
,
**
kw
)
def
getAvailableInventory
(
self
,
**
kw
):
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getAvailableInventory
(
node_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource_uid
=
self
.
resource_uid
,
**
kw
)
return
self
.
_callSimulationTool
(
'getAvailableInventory'
,
**
kw
)
def
getQuantityUnit
(
self
,
**
kw
):
resource
=
self
.
getResourceValue
()
...
...
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