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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
02ed81b2
Commit
02ed81b2
authored
Jun 08, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more interpolation implementation
parent
df3a8f07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
product/ERP5/Tool/SimulationTool.py
product/ERP5/Tool/SimulationTool.py
+14
-5
No files found.
product/ERP5/Tool/SimulationTool.py
View file @
02ed81b2
...
...
@@ -652,6 +652,7 @@ class SimulationTool(BaseTool):
# if we consider flow, we also select movement whose mirror date is
# in the from_date/to_date range and movement whose
# start_date/stop_date contains the report range.
# XXX review this
column_value_dict
[
'date'
]
=
ComplexQuery
(
Query
(
date
=
(
from_date
,
to_date
),
range
=
'minmax'
),
Query
(
mirror_date
=
(
from_date
,
to_date
),
range
=
'minmax'
),
...
...
@@ -1031,11 +1032,16 @@ class SimulationTool(BaseTool):
output_simulation_state - only take rows with specified simulation_state
and quantity < 0
interpolation_method - XXX name ???? how to evaluate flow movement.
* full (default): Consider the movement decreases 100% of source stock on
start date and increase 100% of the destination node stock on stop date.
interpolation_method - Method to consider movements when calculating flows.
* (default): Consider the movement decreases 100% of source stock on
start date and increase 100% of the destination node stock on stop
date.
* linear: consider the movement decreases source stock and increase
destination stock linearly between start date and stop date.
* all_or_nothing: consider only movement who starts after the beginning of
the query period and finishes after the end of the query period.
* one_for_all: consider the movement fully as long as it is partially
contained in the query period.
ignore_variation - do not take into account variation in inventory
calculation (useless on getInventory, but useful on
...
...
@@ -1351,7 +1357,7 @@ class SimulationTool(BaseTool):
stock_sql_kw
.
update
(
base_inventory_kw
)
# TODO: move in _generateSQLKeywordDictFromKeywordDict
if
interpolation_method
==
'linear'
:
if
interpolation_method
in
(
'linear'
,
'all_or_nothing'
,
'one_for_all'
)
:
# XXX only DateTime instance are supported
from_date
=
kw
.
get
(
'from_date'
)
if
from_date
:
...
...
@@ -1359,9 +1365,12 @@ class SimulationTool(BaseTool):
to_date
=
kw
.
get
(
'to_date'
)
if
to_date
:
to_date
=
to_date
.
toZone
(
"UTC"
)
# TODO: support at_date ?
at_date
=
kw
.
get
(
'at_date'
)
if
at_date
:
at_date
=
at_date
.
toZone
(
"UTC"
)
stock_sql_kw
[
'interpolation_method_from_date'
]
=
from_date
stock_sql_kw
[
'interpolation_method_to_date'
]
=
to_date
stock_sql_kw
[
'interpolation_method_at_date'
]
=
at_date
elif
interpolation_method
!=
'default'
:
raise
ValueError
(
"Unsupported interpolation_method %r"
%
(
interpolation_method
,))
...
...
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