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
b3510881
Commit
b3510881
authored
Feb 14, 2019
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
May 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: Update fix supply builder for rounding error
parent
e1c65e05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
...TemplateItem/portal_components/mixin.erp5.BuilderMixin.py
+5
-7
No files found.
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
View file @
b3510881
...
@@ -347,9 +347,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -347,9 +347,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
min_order_in_default_quantity_unit
=
min_order
*
order_quantity_unit_default_quantity_unit_conversion_ratio
min_order_in_default_quantity_unit
=
min_order
*
order_quantity_unit_default_quantity_unit_conversion_ratio
if
max_order
:
if
max_order
:
max_order_in_default_quantity_unit
=
max_order
*
order_quantity_unit_default_quantity_unit_conversion_ratio
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
:
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
:
if
flow_quantity_unit_value
is
not
None
:
flow_quantity_unit_relative_url
=
flow_quantity_unit_value
.
getCategoryRelativeUrl
()
flow_quantity_unit_relative_url
=
flow_quantity_unit_value
.
getCategoryRelativeUrl
()
...
@@ -370,7 +369,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -370,7 +369,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
def
minimalQuantity
(
quantity
,
date
):
def
minimalQuantity
(
quantity
,
date
):
# Initiate variables to match original script from Yusei T.
# Initiate variables to match original script from Yusei T.
# XXX To be cleaned
# 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
delay_second
=
max_delay_second
or
min_delay_second
or
0
limit_date
=
getPreviousValidDate
(
date
)
limit_date
=
getPreviousValidDate
(
date
)
...
@@ -381,8 +379,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -381,8 +379,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
order_delay_second
=
max_order_delay_second
or
min_order_delay_second
or
0
order_delay_second
=
max_order_delay_second
or
min_order_delay_second
or
0
effective_date
=
addToDate
(
start_date
,
second
=-
order_delay_second
)
effective_date
=
addToDate
(
start_date
,
second
=-
order_delay_second
)
order_quantity
=
ceil
(
quantity
*
conversion_ratio
)
order_quantity
=
ceil
(
quantity
/
order_quantity_unit_default_quantity_unit_
conversion_ratio
)
quantity
=
order_quantity
/
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
return
order_quantity
,
order_quantity_unit_value
,
effective_date
,
start_date
,
stop_date
,
quantity
...
@@ -500,7 +498,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -500,7 +498,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
next_next_period_start_date
=
DateTime
(
supply
.
getNextPeriodicalDate
(
next_next_period_start_date
=
DateTime
(
supply
.
getNextPeriodicalDate
(
next_period_start_date
,
next_period_start_date
,
next_start_date
=
next_period_start_date
)).
earliestTime
()
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
# prepare new hixtory_list
while
history_list
and
history_list
[
0
][
0
]
<
next_next_period_start_date
:
while
history_list
and
history_list
[
0
][
0
]
<
next_next_period_start_date
:
next_period_history_list
.
append
(
history_list
.
pop
(
0
))
next_period_history_list
.
append
(
history_list
.
pop
(
0
))
...
@@ -543,7 +541,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -543,7 +541,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))
#self.log("at %s min: %s, inventory:%s, quantity:%s" % (period_start_date, min_inventory, future_inventory_to_date, quantity))
if
quantity
!=
0
:
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
(
movement_list
.
append
(
newMovement
(
newMovement
(
effective_date
,
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