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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e42e8e15
Commit
e42e8e15
authored
Mar 19, 2018
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: Supply builder improved
parent
d520a704
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
12 deletions
+31
-12
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+31
-12
No files found.
product/ERP5/mixin/builder.py
View file @
e42e8e15
...
...
@@ -393,12 +393,29 @@ class BuilderMixin(XMLObject, Amount, Predicate):
movement_list
=
[]
# Remove the Past
previous_movement_list
=
portal
.
portal_catalog
(
portal_type
=
self
.
getDeliveryLinePortalType
(),
simulation_state
=
"auto_planned"
,
strict_resource_uid
=
supply
.
getResourceUid
(),
#strict_source_uid=supply.getSourceUid(),
#strict_source_section_uid=supply.getSourceSectionUid(),
#strict_destination_uid=supply.getDestinationUid(),
#strict_destination_section_uid=supply.getDestinationSectionUid(),
parent_delivery_start_date
=
{
'query'
:
(
supply
.
getStartDateRangeMin
(),
supply
.
getStartDateRangeMax
()),
'range'
:
"minmax"
},
)
#previous_movement_list= []
for
brain
in
previous_movement_list
:
brain
.
getObject
().
setQuantity
(
0
)
# Prepare history list to work with
history_list
=
resource_value
.
Resource_getInventoryHistoryList
(
from_date
=
from_date
,
node_uid
=
supply
.
getDestinationUid
()
# XXX This should be bound to a stard and stop date
)
#self.log("history_list len: %s" % len(history_list))
# evaluate future inventory at date
future_inventory_to_date
=
portal
.
portal_simulation
.
getFutureInventory
(
...
...
@@ -418,6 +435,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
# Hackish and dangerous
next_start_date
=
limit_date
)).
earliestTime
()
#self.log(limit_date_list)
# Create a movement per period
for
period_start_date
in
limit_date_list
:
...
...
@@ -439,7 +457,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
)
quantity
=
0
#self.log("at %s min: %s, Ordered: %s, inventory:%s, quantity:%s" % (date, min_inventory, ordered_inventory, inventory, quantity))
if
future_inventory_to_date
<
min_inventory
:
# SKU
quantity
=
min_inventory
-
future_inventory_to_date
...
...
@@ -449,9 +466,11 @@ class BuilderMixin(XMLObject, Amount, Predicate):
if
start_date
>
supply
.
getStartDateRangeMax
():
break
if
start_date
<
supply
.
getStartDateRangeMin
():
break
continue
#self.log("Week %s Will order %s at %s for period %s" % (delivery_date.week(), quantity, delivery_date, period_start_date))
#self.log("at %s min: %s, inventory:%s, quantity:%s" % (period_start_date, min_inventory, future_inventory_to_date, quantity))
if
quantity
!=
0
:
self
.
log
(
"Week %s Will order %s at %s for period %s"
%
(
delivery_date
.
week
(),
quantity
,
delivery_date
,
period_start_date
))
movement_list
.
append
(
newMovement
(
effective_date
,
...
...
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