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
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
Commits
3e9c87c3
Commit
3e9c87c3
authored
Sep 15, 2016
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inventories: allow to pass more parameters to getNextAlertInventoryDate
parent
7c7b15d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
product/ERP5/Tool/SimulationTool.py
product/ERP5/Tool/SimulationTool.py
+24
-6
No files found.
product/ERP5/Tool/SimulationTool.py
View file @
3e9c87c3
...
@@ -2021,13 +2021,23 @@ class SimulationTool(BaseTool):
...
@@ -2021,13 +2021,23 @@ class SimulationTool(BaseTool):
'getNextAlertInventoryDate'
)
'getNextAlertInventoryDate'
)
def
getNextAlertInventoryDate
(
self
,
reference_quantity
=
0
,
src__
=
0
,
def
getNextAlertInventoryDate
(
self
,
reference_quantity
=
0
,
src__
=
0
,
simulation_period
=
'Future'
,
from_date
=
None
,
simulation_period
=
'Future'
,
from_date
=
None
,
range
=
'min'
,
**
kw
):
range
=
'min'
,
initial_inventory_kw
=
None
,
inventory_list_kw
=
None
,
**
kw
):
"""
"""
Give the next date where the quantity is lower than the
Give the next date where the quantity is lower than the
reference quantity.
reference quantity. This is calculated by first looking if inventory
right now is good or not. If not, then look at inventory list until
a movement makes the inventory like expected.
range - either 'min' (default) or 'nlt'. With 'nlt', returns
range - either 'min' (default) or 'nlt'. With 'nlt', returns
the next date where inventory is above reference_quantity
the next date where inventory is above reference_quantity
initial_inventory_kw - additional parameters for the initial inventory
inventory_list_kw - additional parameters for looking at next movements
(exemple: use omit_output)
"""
"""
result
=
None
result
=
None
# First look at current inventory, we might have already an inventory
# First look at current inventory, we might have already an inventory
...
@@ -2043,18 +2053,26 @@ class SimulationTool(BaseTool):
...
@@ -2043,18 +2053,26 @@ class SimulationTool(BaseTool):
checkQuantity
=
getCheckQuantityMethod
()
checkQuantity
=
getCheckQuantityMethod
()
if
from_date
is
None
:
if
from_date
is
None
:
from_date
=
DateTime
()
from_date
=
DateTime
()
def
getAugmentedInventoryKeyword
(
additional_kw
):
inventory_kw
=
kw
if
additional_kw
:
inventory_kw
=
kw
.
copy
()
inventory_kw
.
update
(
additional_kw
)
return
inventory_kw
inventory_method
=
getattr
(
self
,
"get%sInventory"
%
simulation_period
)
inventory_method
=
getattr
(
self
,
"get%sInventory"
%
simulation_period
)
current_inventory
=
inventory_method
(
at_date
=
from_date
,
**
kw
)
initial_inventory
=
inventory_method
(
at_date
=
from_date
,
if
checkQuantity
(
current_inventory
):
**
getAugmentedInventoryKeyword
(
initial_inventory_kw
))
if
checkQuantity
(
initial_inventory
):
result
=
from_date
result
=
from_date
else
:
else
:
inventory_list_method
=
getattr
(
self
,
inventory_list_method
=
getattr
(
self
,
"get%sInventoryList"
%
simulation_period
)
"get%sInventoryList"
%
simulation_period
)
inventory_list
=
inventory_list_method
(
src__
=
src__
,
from_date
=
from_date
,
inventory_list
=
inventory_list_method
(
src__
=
src__
,
from_date
=
from_date
,
sort_on
=
((
'date'
,
'ascending'
),),
group_by_movement
=
1
,
**
kw
)
sort_on
=
((
'date'
,
'ascending'
),),
group_by_movement
=
1
,
**
getAugmentedInventoryKeyword
(
inventory_list_kw
))
if
src__
:
if
src__
:
return
inventory_list
return
inventory_list
total_inventory
=
0.
total_inventory
=
initial_inventory
for
inventory
in
inventory_list
:
for
inventory
in
inventory_list
:
if
inventory
[
'inventory'
]
is
not
None
:
if
inventory
[
'inventory'
]
is
not
None
:
total_inventory
+=
inventory
[
'inventory'
]
total_inventory
+=
inventory
[
'inventory'
]
...
...
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