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
Laurent S
erp5
Commits
4320819e
Commit
4320819e
authored
Apr 03, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefer uid over relative_url
Also remove copy pasted comments
parent
4df2c07f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
42 deletions
+14
-42
product/ERP5/Extensions/InventoryBrain.py
product/ERP5/Extensions/InventoryBrain.py
+14
-42
No files found.
product/ERP5/Extensions/InventoryBrain.py
View file @
4320819e
...
@@ -42,17 +42,11 @@ class InventoryBrain(ZSQLBrain):
...
@@ -42,17 +42,11 @@ class InventoryBrain(ZSQLBrain):
return
inventory
return
inventory
def
getCurrentInventory
(
self
):
def
getCurrentInventory
(
self
):
"""
Returns current inventory
"""
return
self
.
getInventory
(
return
self
.
getInventory
(
simulation_state
=
self
.
getPortalCurrentInventoryStateList
(),
simulation_state
=
self
.
getPortalCurrentInventoryStateList
(),
ignore_variation
=
1
)
ignore_variation
=
1
)
def
getFutureInventory
(
self
):
def
getFutureInventory
(
self
):
"""
Returns current inventory
"""
return
self
.
getInventory
(
return
self
.
getInventory
(
ignore_variation
=
1
,
ignore_variation
=
1
,
simulation_state
=
\
simulation_state
=
\
...
@@ -61,9 +55,6 @@ class InventoryBrain(ZSQLBrain):
...
@@ -61,9 +55,6 @@ class InventoryBrain(ZSQLBrain):
list
(
self
.
getPortalCurrentInventoryStateList
()))
list
(
self
.
getPortalCurrentInventoryStateList
()))
def
getAvailableInventory
(
self
):
def
getAvailableInventory
(
self
):
"""
Returns current inventory
"""
at_date
=
DateTime
()
at_date
=
DateTime
()
current
=
self
.
getCurrentInventory
()
current
=
self
.
getCurrentInventory
()
result
=
self
.
Resource_zGetInventory
(
result
=
self
.
Resource_zGetInventory
(
...
@@ -80,12 +71,9 @@ class InventoryBrain(ZSQLBrain):
...
@@ -80,12 +71,9 @@ class InventoryBrain(ZSQLBrain):
return
current
+
reserved_inventory
return
current
+
reserved_inventory
def
getQuantityUnit
(
self
,
**
kw
):
def
getQuantityUnit
(
self
,
**
kw
):
try
:
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
if
resource
is
not
None
:
self
.
resource_relative_url
)
return
resource
.
getQuantityUnit
()
return
resource
.
getQuantityUnit
()
except
AttributeError
:
return
''
class
InventoryListBrain
(
ZSQLBrain
):
class
InventoryListBrain
(
ZSQLBrain
):
"""
"""
...
@@ -94,52 +82,37 @@ class InventoryListBrain(ZSQLBrain):
...
@@ -94,52 +82,37 @@ class InventoryListBrain(ZSQLBrain):
# Stock management
# Stock management
def
getInventory
(
self
,
**
kw
):
def
getInventory
(
self
,
**
kw
):
"""
Returns the inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getInventory
(
return
simulation_tool
.
getInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getCurrentInventory
(
self
,
**
kw
):
def
getCurrentInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getCurrentInventory
(
return
simulation_tool
.
getCurrentInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getFutureInventory
(
self
,
**
kw
):
def
getFutureInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getFutureInventory
(
return
simulation_tool
.
getFutureInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getAvailableInventory
(
self
,
**
kw
):
def
getAvailableInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getAvailableInventory
(
return
simulation_tool
.
getAvailableInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getQuantityUnit
(
self
,
**
kw
):
def
getQuantityUnit
(
self
,
**
kw
):
try
:
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
if
resource
is
not
None
:
self
.
resource_relative_url
)
return
resource
.
getQuantityUnit
()
return
resource
.
getQuantityUnit
()
except
AttributeError
:
return
''
def
getListItemUrl
(
self
,
cname_id
,
selection_index
,
selection_name
):
def
getListItemUrl
(
self
,
cname_id
,
selection_index
,
selection_name
):
"""Returns the URL for column `cname_id`. Used by ListBox
"""Returns the URL for column `cname_id`. Used by ListBox
...
@@ -159,10 +132,9 @@ class InventoryListBrain(ZSQLBrain):
...
@@ -159,10 +132,9 @@ class InventoryListBrain(ZSQLBrain):
explanation
.
getRelativeUrl
())
explanation
.
getRelativeUrl
())
else
:
else
:
return
''
return
''
elif
getattr
(
self
,
'resource_
relative_url
'
,
None
)
is
not
None
:
elif
getattr
(
self
,
'resource_
uid
'
,
None
)
is
not
None
:
# A resource is defined, so try to display the movement list
# A resource is defined, so try to display the movement list
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
self
.
resource_relative_url
)
form_name
=
'Resource_viewMovementHistory'
form_name
=
'Resource_viewMovementHistory'
query_kw
=
{
query_kw
=
{
'variation_text'
:
self
.
variation_text
,
'variation_text'
:
self
.
variation_text
,
...
...
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