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
c78a3b0d
Commit
c78a3b0d
authored
Feb 14, 2019
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: Update fix supply builder for rounding error
parent
31e63f1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+5
-7
No files found.
product/ERP5/mixin/builder.py
View file @
c78a3b0d
...
...
@@ -340,9 +340,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
min_order_in_default_quantity_unit
=
min_order
*
order_quantity_unit_default_quantity_unit_conversion_ratio
if
max_order
:
max_order_in_default_quantity_unit
=
max_order
*
order_quantity_unit_default_quantity_unit_conversion_ratio
default_quantity_unit_order_quantity_unit_conversion_ratio
=
1
/
order_quantity_unit_default_quantity_unit_conversion_ratio
else
:
default_quantity_unit_order
_quantity_unit_conversion_ratio
=
1
order_quantity_unit_default
_quantity_unit_conversion_ratio
=
1
if
flow_quantity_unit_value
is
not
None
:
flow_quantity_unit_relative_url
=
flow_quantity_unit_value
.
getCategoryRelativeUrl
()
...
...
@@ -363,7 +362,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
def
minimalQuantity
(
quantity
,
date
):
# Initiate variables to match original script from Yusei T.
# XXX To be cleaned
conversion_ratio
=
default_quantity_unit_order_quantity_unit_conversion_ratio
delay_second
=
max_delay_second
or
min_delay_second
or
0
limit_date
=
getPreviousValidDate
(
date
)
...
...
@@ -374,8 +372,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
order_delay_second
=
max_order_delay_second
or
min_order_delay_second
or
0
effective_date
=
addToDate
(
start_date
,
second
=-
order_delay_second
)
order_quantity
=
ceil
(
quantity
*
conversion_ratio
)
quantity
=
order_quantity
/
conversion_ratio
order_quantity
=
ceil
(
quantity
/
order_quantity_unit_default_quantity_unit_
conversion_ratio
)
quantity
=
order_quantity
*
order_quantity_unit_default_quantity_unit_
conversion_ratio
return
order_quantity
,
order_quantity_unit_value
,
effective_date
,
start_date
,
stop_date
,
quantity
...
...
@@ -489,7 +487,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
next_next_period_start_date
=
DateTime
(
supply
.
getNextPeriodicalDate
(
next_period_start_date
,
next_start_date
=
next_period_start_date
)).
earliestTime
()
if
factor
and
next_next_period_start_date
<=
last_date
:
if
factor
and
next_next_period_start_date
:
# prepare new hixtory_list
while
history_list
and
history_list
[
0
][
0
]
<
next_next_period_start_date
:
next_period_history_list
.
append
(
history_list
.
pop
(
0
))
...
...
@@ -532,7 +530,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
#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
))
self
.
log
(
"Week %s Will order %
r
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