Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
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
Hide 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):
return
inventory
def
getCurrentInventory
(
self
):
"""
Returns current inventory
"""
return
self
.
getInventory
(
simulation_state
=
self
.
getPortalCurrentInventoryStateList
(),
ignore_variation
=
1
)
def
getFutureInventory
(
self
):
"""
Returns current inventory
"""
return
self
.
getInventory
(
ignore_variation
=
1
,
simulation_state
=
\
...
...
@@ -61,9 +55,6 @@ class InventoryBrain(ZSQLBrain):
list
(
self
.
getPortalCurrentInventoryStateList
()))
def
getAvailableInventory
(
self
):
"""
Returns current inventory
"""
at_date
=
DateTime
()
current
=
self
.
getCurrentInventory
()
result
=
self
.
Resource_zGetInventory
(
...
...
@@ -80,12 +71,9 @@ class InventoryBrain(ZSQLBrain):
return
current
+
reserved_inventory
def
getQuantityUnit
(
self
,
**
kw
):
try
:
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
self
.
resource_relative_url
)
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
if
resource
is
not
None
:
return
resource
.
getQuantityUnit
()
except
AttributeError
:
return
''
class
InventoryListBrain
(
ZSQLBrain
):
"""
...
...
@@ -94,52 +82,37 @@ class InventoryListBrain(ZSQLBrain):
# Stock management
def
getInventory
(
self
,
**
kw
):
"""
Returns the inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getCurrentInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getCurrentInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getFutureInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getFutureInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getAvailableInventory
(
self
,
**
kw
):
"""
Returns current inventory
"""
simulation_tool
=
getToolByName
(
self
,
'portal_simulation'
)
return
simulation_tool
.
getAvailableInventory
(
node
=
self
.
node_relative_url
,
node
_uid
=
self
.
node_uid
,
variation_text
=
self
.
variation_text
,
resource
=
self
.
resource_relative_url
,
**
kw
)
resource
_uid
=
self
.
resource_uid
,
**
kw
)
def
getQuantityUnit
(
self
,
**
kw
):
try
:
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
self
.
resource_relative_url
)
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
if
resource
is
not
None
:
return
resource
.
getQuantityUnit
()
except
AttributeError
:
return
''
def
getListItemUrl
(
self
,
cname_id
,
selection_index
,
selection_name
):
"""Returns the URL for column `cname_id`. Used by ListBox
...
...
@@ -159,10 +132,9 @@ class InventoryListBrain(ZSQLBrain):
explanation
.
getRelativeUrl
())
else
:
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
resource
=
self
.
portal_categories
.
unrestrictedTraverse
(
self
.
resource_relative_url
)
resource
=
self
.
portal_catalog
.
getObject
(
self
.
resource_uid
)
form_name
=
'Resource_viewMovementHistory'
query_kw
=
{
'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