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
ae97add1
Commit
ae97add1
authored
Mar 12, 2018
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: Fixup supply builder
parent
c23a6d11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+5
-6
No files found.
product/ERP5/mixin/builder.py
View file @
ae97add1
...
@@ -357,9 +357,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -357,9 +357,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
conversion_ratio
=
default_quantity_unit_order_quantity_unit_conversion_ratio
conversion_ratio
=
default_quantity_unit_order_quantity_unit_conversion_ratio
delay_second
=
max_delay_second
or
min_delay_second
or
0
delay_second
=
max_delay_second
or
min_delay_second
or
0
# XXX Hardcoded that we need to receive one day before...
limit_date
=
getPreviousValidDate
(
date
)
# Very bad....
limit_date
=
getPreviousValidDate
(
date
)
-
1
start_date
=
getPreviousValidDate
(
start_date
=
getPreviousValidDate
(
addToDate
(
limit_date
,
second
=-
delay_second
)
addToDate
(
limit_date
,
second
=-
delay_second
)
)
)
...
@@ -412,11 +410,12 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -412,11 +410,12 @@ class BuilderMixin(XMLObject, Amount, Predicate):
supply
=
supply
,
supply
=
supply
,
history_list
=
history_list
,
history_list
=
history_list
,
at_date
=
date
,
at_date
=
date
,
conversion_ratio
=
default_quantity_unit_order_quantity_unit_conversion_ratio
,
)
)
self
.
log
(
"at %s min: %s, Ordered: %s, inventory:%s, quantity:%s"
%
(
date
,
min_inventory
,
ordered_inventory
,
inventory
,
quantity
))
#
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
if
ordered_inventory
+
(
inventory
-
quantity
)
<
min_inventory
:
# SKU
#import pdb;pdb.set_trace()
#import pdb;pdb.set_trace()
quantity
=
min_inventory
-
(
inventory
)
-
ordered_inventory
quantity
=
min_inventory
-
(
inventory
-
quantity
)
-
ordered_inventory
ordered_quantity
,
ordered_unit
,
effective_date
,
start_date
,
delivery_date
,
quantity
=
minimalQuantity
(
quantity
,
date
)
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
# XXX CLN This is very naive, it has to be optimized
if
start_date
<=
supply
.
getStartDateRangeMax
()
\
if
start_date
<=
supply
.
getStartDateRangeMax
()
\
...
...
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