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
49a41f35
Commit
49a41f35
authored
Feb 08, 2018
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder: fixup add missing part for effective date
parent
b28a8e6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+11
-6
No files found.
product/ERP5/mixin/builder.py
View file @
49a41f35
...
...
@@ -362,13 +362,16 @@ class BuilderMixin(XMLObject, Amount, Predicate):
addToDate
(
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
effective_date
=
addToDate
(
start_date
,
second
=-
order_delay_second
)
order_quantity
=
ceil
(
quantity
*
conversion_ratio
)
quantity
=
order_quantity
/
conversion_ratio
return
order_quantity
,
order_quantity_unit_value
,
start_date
,
stop_date
,
quantity
return
order_quantity
,
order_quantity_unit_value
,
effective_date
,
start_date
,
stop_date
,
quantity
resource_portal_type
=
resource_value
.
getPortalType
()
def
newMovement
(
start_date
,
stop_date
,
quantity
,
quantity_unit
):
def
newMovement
(
effective_date
,
start_date
,
stop_date
,
quantity
,
quantity_unit
):
# Create temporary movement
# Do not handle variation and Item for now
movement
=
newTempMovement
(
portal
,
"temp"
)
...
...
@@ -381,6 +384,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
resource_portal_type
=
resource_portal_type
,
quantity_unit_value
=
quantity_unit
,
quantity
=
quantity
,
effective_date
=
effective_date
,
start_date
=
start_date
,
stop_date
=
stop_date
,
reference
=
resource_value
.
getReference
(),
...
...
@@ -410,14 +414,15 @@ class BuilderMixin(XMLObject, Amount, Predicate):
if
ordered_inventory
+
(
inventory
-
quantity
)
<
min_inventory
:
# SKU
#import pdb;pdb.set_trace()
quantity
=
min_inventory
-
(
inventory
-
quantity
)
-
ordered_inventory
ordered_quantity
,
ordered_unit
,
ordered
_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
if
ordered
_date
<=
supply
.
getStartDateRangeMax
()
\
and
ordered
_date
>=
supply
.
getStartDateRangeMin
():
if
start
_date
<=
supply
.
getStartDateRangeMax
()
\
and
start
_date
>=
supply
.
getStartDateRangeMin
():
ordered_inventory
=
ordered_inventory
+
quantity
movement_list
.
append
(
newMovement
(
ordered_date
,
effective_date
,
start_date
,
delivery_date
,
ordered_quantity
,
ordered_unit
...
...
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