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
1
Merge Requests
1
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
Cédric Le Ninivin
erp5
Commits
9f80c4b1
Commit
9f80c4b1
authored
Feb 21, 2018
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: Tweak and fix supply builder
parent
739e83d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+9
-5
No files found.
product/ERP5/mixin/builder.py
View file @
9f80c4b1
...
...
@@ -355,11 +355,13 @@ class BuilderMixin(XMLObject, Amount, Predicate):
# Initiate variables to match original script from Yusei T.
# XXX To be cleaned
conversion_ratio
=
default_quantity_unit_order_quantity_unit_conversion_ratio
next_date
=
date
delay_second
=
max_delay_second
or
min_delay_second
or
0
# XXX Hardcoded that we need to receive one day before...
# Very bad....
limit_date
=
getPreviousValidDate
(
date
)
-
1
start_date
=
getPreviousValidDate
(
addToDate
(
date
,
second
=-
delay_second
)
addToDate
(
limit_
date
,
second
=-
delay_second
)
)
stop_date
=
addToDate
(
start_date
,
second
=
delay_second
).
earliestTime
()
order_delay_second
=
max_order_delay_second
or
min_order_delay_second
or
0
...
...
@@ -411,13 +413,15 @@ class BuilderMixin(XMLObject, Amount, Predicate):
history_list
=
history_list
,
at_date
=
date
,
)
if
ordered_inventory
+
(
inventory
-
quantity
)
<
min_inventory
:
# SKU
self
.
log
(
"at %s min: %s, Ordered: %s, inventory:%s, quantity:%s"
%
(
date
,
min_inventory
,
ordered_inventory
,
inventory
,
quantity
))
if
ordered_inventory
+
(
inventory
)
<
min_inventory
:
# SKU
#import pdb;pdb.set_trace()
quantity
=
min_inventory
-
(
inventory
-
quantity
)
-
ordered_inventory
quantity
=
min_inventory
-
(
inventory
)
-
ordered_inventory
ordered_quantity
,
ordered_unit
,
effective_date
,
start_date
,
delivery_date
,
quantity
=
minimalQuantity
(
quantity
,
date
)
# XXX CLN This is very naive, it has to be optimized
if
start_date
<=
supply
.
getStartDateRangeMax
()
\
and
start_date
>=
supply
.
getStartDateRangeMin
():
self
.
log
(
"Week %s Will order %s at %s"
%
(
delivery_date
.
week
(),
quantity
,
delivery_date
))
ordered_inventory
=
ordered_inventory
+
quantity
movement_list
.
append
(
newMovement
(
...
...
@@ -429,6 +433,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
)
)
history_list
.
pop
(
0
)
return
[]
return
movement_list
def
_searchMovementList
(
self
,
**
kw
):
...
...
@@ -585,7 +590,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
created_by_builder
=
1
)
if
self
.
getPortalObject
().
portal_workflow
.
isTransitionPossible
(
delivery
,
"auto_plan"
):
delivery
.
autoPlan
()
delivery
.
immediateReindexObject
()
return
delivery
def
_processDeliveryGroup
(
self
,
delivery_module
,
movement_group_node
,
...
...
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