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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
erp5
Commits
a4c23866
Commit
a4c23866
authored
Oct 27, 2017
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Nov 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testMRP: update testSimpleOrder to integrate Manufacturing Order
parent
71a44eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
41 deletions
+57
-41
product/ERP5/tests/testMRP.py
product/ERP5/tests/testMRP.py
+57
-41
No files found.
product/ERP5/tests/testMRP.py
View file @
a4c23866
...
...
@@ -35,6 +35,8 @@ class TestMRPMixin(TestBPMMixin):
def
afterSetUp
(
self
):
super
(
TestMRPMixin
,
self
).
afterSetUp
()
self
.
_createRule
(
"Transformation Simulation Rule"
)
production_simulation_rule
=
self
.
_createRule
(
"Production Simulation Rule"
)
production_simulation_rule
.
setTradePhase
(
"manufacturing/order"
)
rule
=
self
.
_createRule
(
"Transformation Sourcing Simulation Rule"
)
rule
.
_setSameTotalQuantity
(
False
)
...
...
@@ -116,7 +118,7 @@ class TestMRPMixin(TestBPMMixin):
self
.
createCategoriesInCategory
(
category_tool
.
trade_phase
.
mrp
,
(
's'
+
str
(
i
)
for
i
in
xrange
(
1
)))
self
.
createCategoriesInCategory
(
category_tool
.
trade_state
,
(
's'
+
str
(
i
)
for
i
in
xrange
(
5
)))
(
's'
+
str
(
i
)
for
i
in
xrange
(
6
)))
def
createDefaultOrder
(
self
,
business_process
,
transformation
=
None
):
if
transformation
is
None
:
...
...
@@ -161,7 +163,7 @@ class TestMRPMixin(TestBPMMixin):
trade_phase
=
'mrp/p1'
)
return
transformation
def
createBusinessProcess1
(
self
,
node_p0
=
None
):
def
createBusinessProcess1
(
self
,
node_p0
):
"""
Terms
=====
...
...
@@ -179,6 +181,7 @@ class TestMRPMixin(TestBPMMixin):
================
The Business process will proceed this way:
1/ Generate Production Order and confirm it
2/ Generate Manufacturing Order and confirm it
2/ Generate Manufacturing Execution p0 which generate a
the product with a variation to indicate it is a partial product.
The variation is trade_phase/mrp/p0. It takes place in workshop2
...
...
@@ -193,9 +196,9 @@ class TestMRPMixin(TestBPMMixin):
Business Process Schema
=======================
order p0 s0 p1 deliver
------- S0 ----
S1 ---- S2 ---- S3 ------- S4
PO
ME1 PPL1
ME2 PPL2
order
order
p0 s0 p1 deliver
------- S0 ----
- S1 ---- S2 ---- S3 ---- S4 -------- S5
PO
MO ME1 PPL1
ME2 PPL2
Simulation Tree
===============
...
...
@@ -203,30 +206,34 @@ class TestMRPMixin(TestBPMMixin):
* Production Order Line
* default_delivering_rule
* PPL2
* default_transformation_rule
* input ME1
* input ME1
* output ME1 - partial product
* input ME2 - partial product
* default_transformation_source_rule
* PPL1
* input ME2
* default_transformation_source_rule
* input ME2
* default_transformation_source_rule
* output ME2
* default_production_rule
* MO
* default_transformation_rule
* input ME1
* input ME1
* output ME1 - partial product
* input ME2 - partial product
* default_transformation_source_rule
* PPL1
* input ME2
* default_transformation_source_rule
* input ME2
* default_transformation_source_rule
* output ME2
"""
business_process
=
self
.
_createDocument
(
"Business Process"
)
builder
=
'portal_deliveries/production_packing_list_builder'
production_packing_list_builder
=
'portal_deliveries/production_packing_list_builder'
manufacturing_execution_builder
=
'portal_deliveries/manufacturing_execution_builder'
manufacturing_order_builder
=
'portal_deliveries/manufacturing_order_builder'
completed
=
'delivered'
,
'started'
,
'stopped'
phase_list
=
[
(
'default/order'
,
None
,
(
'confirmed'
,)),
(
'default/delivery'
,
builder
,
completed
)]
phase_list
[
1
:
1
]
=
[(
'mrp/p'
+
str
(
i
),
'portal_deliveries/manufacturing_execution_builder'
,
completed
)
for
i
in
xrange
(
2
)]
if
node_p0
is
not
None
:
phase_list
.
insert
(
2
,
(
'mrp/s0'
,
builder
,
completed
))
phase_list
=
[
(
'default/order'
,
None
,
(
'confirmed'
,)),
(
'manufacturing/order'
,
manufacturing_order_builder
,
(
'confirmed'
,)
),
(
'mrp/p0'
,
manufacturing_execution_builder
,
completed
)
,
(
'mrp/s0'
,
production_packing_list_builder
,
completed
),
(
'mrp/p1'
,
manufacturing_execution_builder
,
completed
),
(
'default/delivery'
,
production_packing_list_builder
,
completed
)
]
predecessor
=
None
for
i
,
(
phase
,
builder
,
completed
)
in
enumerate
(
phase_list
):
successor
=
'trade_state/s'
+
str
(
i
)
...
...
@@ -238,13 +245,12 @@ class TestMRPMixin(TestBPMMixin):
delivery_builder
=
builder
)
predecessor
=
successor
phase_list
=
[
x
[
0
]
for
x
in
phase_list
]
if
node_p0
is
not
None
:
self
.
createTradeModelPath
(
business_process
,
destination_value
=
node_p0
,
trade_phase
=
phase_list
.
pop
(
1
))
self
.
createTradeModelPath
(
business_process
,
test_tales_expression
=
"here/getSource"
,
trade_phase
=
phase_list
.
pop
(
1
))
self
.
createTradeModelPath
(
business_process
,
destination_value
=
node_p0
,
trade_phase
=
phase_list
.
pop
(
2
))
self
.
createTradeModelPath
(
business_process
,
test_tales_expression
=
"here/getSource"
,
trade_phase
=
phase_list
.
pop
(
2
))
self
.
createTradeModelPath
(
business_process
,
trade_phase_list
=
phase_list
)
return
business_process
...
...
@@ -288,6 +294,10 @@ class TestMRPImplementation(TestMRPMixin):
ar
,
=
sm
.
objectValues
()
# The final PPL
sm
,
=
ar
.
objectValues
()
# deliver
# default_production_rule
ar
,
=
sm
.
objectValues
()
# Manufacturing Order Movements
sm
,
=
ar
.
objectValues
()
# Order
# default_transformation_rule
ar
,
=
sm
.
objectValues
()
...
...
@@ -322,16 +332,22 @@ class TestMRPImplementation(TestMRPMixin):
)))
order
.
confirm
()
# Build Manufacturing Order
order
.
localBuild
()
self
.
tic
()
self
.
checkStock
(
resource
)
def
getRelatedDeliveryList
(
portal_type
):
return
order
.
getCausalityRelatedValueList
(
portal_type
=
portal_type
)
pr1
,
=
getRelatedDeliveryList
(
"Manufacturing Execution"
)
pr1
.
start
()
pr1
.
deliver
()
mo
,
=
getRelatedDeliveryList
(
"Manufacturing Order Line"
)
# Build First Manufacturing Execution
order
.
localBuild
()
self
.
tic
()
self
.
checkStock
(
resource
)
me1
,
=
getRelatedDeliveryList
(
"Manufacturing Execution"
)
me1
.
start
()
me1
.
deliver
()
order
.
localBuild
()
self
.
tic
()
variation
=
'industrial_phase/trade_phase/mrp/p0'
...
...
@@ -344,10 +360,10 @@ class TestMRPImplementation(TestMRPMixin):
self
.
tic
()
self
.
checkStock
(
resource
,
(
self
.
workshop
,
variation
,
10
))
pr
2
,
=
(
x
for
x
in
getRelatedDeliveryList
(
"Manufacturing Execution"
)
if
x
.
aq_base
is
not
pr
1
.
aq_base
)
pr
2
.
start
()
pr
2
.
deliver
()
me
2
,
=
(
x
for
x
in
getRelatedDeliveryList
(
"Manufacturing Execution"
)
if
x
.
aq_base
is
not
me
1
.
aq_base
)
me
2
.
start
()
me
2
.
deliver
()
order
.
localBuild
()
self
.
tic
()
self
.
checkStock
(
resource
,
(
self
.
workshop
,
''
,
10
))
...
...
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