Commit c5822540 authored by Julien Muchembled's avatar Julien Muchembled

Move legacy MRP code from erp5_mrp to new erp5_mrp_simulation_legacy

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@39233 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1493f2e0
......@@ -68,28 +68,4 @@
<portal_type id="Supply Chain Module">
<item>Supply Chain</item>
</portal_type>
<portal_type id="Transformation Model Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Sourcing Model Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Sourcing Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
</allowed_content_type_list>
\ No newline at end of file
......@@ -63,20 +63,4 @@
<type>Supply Node</type>
<workflow>edit_workflow</workflow>
</chain>
<chain>
<type>Transformation Model Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Sourcing Model Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Sourcing Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
......@@ -41,7 +41,3 @@ Supply Chain | view
Supply Chain | view_supply_node
Supply Link | view
Supply Node | view
\ No newline at end of file
Transformation Model Rule | view
Transformation Rule | view
Transformation Sourcing Model Rule | view
Transformation Sourcing Rule | view
\ No newline at end of file
......@@ -3,19 +3,3 @@ portal_deliveries/production_packing_list_builder/**
portal_deliveries/production_report_builder
portal_deliveries/production_report_builder/**
portal_domains/production_order_module_specialise_domain
\ No newline at end of file
portal_rules/default_production_order_model_root_simulation_rule
portal_rules/default_production_order_model_root_simulation_rule/**
portal_rules/default_production_order_model_rule
portal_rules/default_production_order_model_rule/**
portal_rules/default_production_order_root_simulation_rule
portal_rules/default_production_order_root_simulation_rule/**
portal_rules/default_production_order_rule
portal_rules/default_production_order_rule/**
portal_rules/default_transformation_model_rule
portal_rules/default_transformation_model_rule/**
portal_rules/default_transformation_rule
portal_rules/default_transformation_rule/**
portal_rules/default_transformation_sourcing_model_rule
portal_rules/default_transformation_sourcing_model_rule/**
portal_rules/default_transformation_sourcing_rule
portal_rules/default_transformation_sourcing_rule/**
\ No newline at end of file
......@@ -35,19 +35,3 @@ Rule Tool | Transformation Sourcing Rule
Supply Chain Module | Supply Chain
Supply Chain | Supply Link
Supply Chain | Supply Node
\ No newline at end of file
Transformation Model Rule | Category Divergence Tester
Transformation Model Rule | Composed Divergence Tester
Transformation Model Rule | Property Divergence Tester
Transformation Model Rule | Quantity Divergence Tester
Transformation Rule | Category Divergence Tester
Transformation Rule | Composed Divergence Tester
Transformation Rule | Property Divergence Tester
Transformation Rule | Quantity Divergence Tester
Transformation Sourcing Model Rule | Category Divergence Tester
Transformation Sourcing Model Rule | Composed Divergence Tester
Transformation Sourcing Model Rule | Property Divergence Tester
Transformation Sourcing Model Rule | Quantity Divergence Tester
Transformation Sourcing Rule | Category Divergence Tester
Transformation Sourcing Rule | Composed Divergence Tester
Transformation Sourcing Rule | Property Divergence Tester
Transformation Sourcing Rule | Quantity Divergence Tester
\ No newline at end of file
......@@ -18,7 +18,3 @@ Supply Chain
Supply Chain Module
Supply Link
Supply Node
\ No newline at end of file
Transformation Model Rule
Transformation Rule
Transformation Sourcing Model Rule
Transformation Sourcing Rule
\ No newline at end of file
......@@ -45,11 +45,3 @@ Supply Chain | edit_workflow
Supply Chain | validation_workflow
Supply Link | edit_workflow
Supply Node | edit_workflow
\ No newline at end of file
Transformation Model Rule | edit_workflow
Transformation Model Rule | rule_validation_workflow
Transformation Rule | edit_workflow
Transformation Rule | rule_validation_workflow
Transformation Sourcing Model Rule | edit_workflow
Transformation Sourcing Model Rule | rule_validation_workflow
Transformation Sourcing Rule | edit_workflow
Transformation Sourcing Rule | rule_validation_workflow
\ No newline at end of file
<allowed_content_type_list>
<portal_type id="Transformation Model Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Sourcing Model Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
<portal_type id="Transformation Sourcing Rule">
<item>Category Divergence Tester</item>
<item>Composed Divergence Tester</item>
<item>Property Divergence Tester</item>
<item>Quantity Divergence Tester</item>
</portal_type>
</allowed_content_type_list>
\ No newline at end of file
<workflow_chain>
<chain>
<type>Transformation Model Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Sourcing Model Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
<chain>
<type>Transformation Sourcing Rule</type>
<workflow>edit_workflow, rule_validation_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
Copyright (c) 2010 Nexedi SA
\ No newline at end of file
erp5_simulation_legacy
erp5_mrp
\ No newline at end of file
GPL
\ No newline at end of file
1
\ No newline at end of file
Transformation Model Rule | view
Transformation Rule | view
Transformation Sourcing Model Rule | view
Transformation Sourcing Rule | view
\ No newline at end of file
1
\ No newline at end of file
portal_rules/default_production_order_model_root_simulation_rule
portal_rules/default_production_order_model_root_simulation_rule/**
portal_rules/default_production_order_model_rule
portal_rules/default_production_order_model_rule/**
portal_rules/default_production_order_root_simulation_rule
portal_rules/default_production_order_root_simulation_rule/**
portal_rules/default_production_order_rule
portal_rules/default_production_order_rule/**
portal_rules/default_transformation_model_rule
portal_rules/default_transformation_model_rule/**
portal_rules/default_transformation_rule
portal_rules/default_transformation_rule/**
portal_rules/default_transformation_sourcing_model_rule
portal_rules/default_transformation_sourcing_model_rule/**
portal_rules/default_transformation_sourcing_rule
portal_rules/default_transformation_sourcing_rule/**
\ No newline at end of file
Transformation Model Rule | Category Divergence Tester
Transformation Model Rule | Composed Divergence Tester
Transformation Model Rule | Property Divergence Tester
Transformation Model Rule | Quantity Divergence Tester
Transformation Rule | Category Divergence Tester
Transformation Rule | Composed Divergence Tester
Transformation Rule | Property Divergence Tester
Transformation Rule | Quantity Divergence Tester
Transformation Sourcing Model Rule | Category Divergence Tester
Transformation Sourcing Model Rule | Composed Divergence Tester
Transformation Sourcing Model Rule | Property Divergence Tester
Transformation Sourcing Model Rule | Quantity Divergence Tester
Transformation Sourcing Rule | Category Divergence Tester
Transformation Sourcing Rule | Composed Divergence Tester
Transformation Sourcing Rule | Property Divergence Tester
Transformation Sourcing Rule | Quantity Divergence Tester
\ No newline at end of file
Transformation Model Rule
Transformation Rule
Transformation Sourcing Model Rule
Transformation Sourcing Rule
\ No newline at end of file
Transformation Model Rule | edit_workflow
Transformation Model Rule | rule_validation_workflow
Transformation Rule | edit_workflow
Transformation Rule | rule_validation_workflow
Transformation Sourcing Model Rule | edit_workflow
Transformation Sourcing Model Rule | rule_validation_workflow
Transformation Sourcing Rule | edit_workflow
Transformation Sourcing Rule | rule_validation_workflow
\ No newline at end of file
0
\ No newline at end of file
0
\ No newline at end of file
erp5_mrp_simulation_legacy
\ No newline at end of file
0.1
\ No newline at end of file
......@@ -7,6 +7,8 @@ InvoiceSimulationRule
InvoiceTransactionSimulationRule
OrderRootSimulationRule
PaymentSimulationRule
ProductionOrderModelRootSimulationRule
ProductionOrderRootSimulationRule
RootAppliedRuleCausalityMovementGroup
SimulationLegacyPatches
TradeModelSimulationRule
......
......@@ -46,6 +46,8 @@ class TestBPMMixin(ERP5TypeTestCase):
business_process_portal_type = 'Business Process'
business_link_portal_type = 'Business Link'
trade_model_path_portal_type = 'Trade Model Path'
default_business_process = \
'business_process_module/erp5_default_business_process'
normal_resource_use_category_list = ['normal']
invoicing_resource_use_category_list = ['discount', 'tax']
......@@ -77,7 +79,7 @@ class TestBPMMixin(ERP5TypeTestCase):
portal_type=self.business_process_portal_type,)
business_process = module.newContent(
portal_type=self.business_process_portal_type,
specialise_value=module.erp5_default_business_process)
specialise=self.default_business_process)
business_process._edit(**kw)
self.createTradeModelPath(business_process,
reference='default_path',
......
......@@ -59,6 +59,10 @@ class TestMRPMixin(TestBPMMixin):
if rule.getValidationState() == 'validated':
rule.invalidate()
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
def _createDocument(self, portal_type, **kw):
module = self.portal.getDefaultModule(
portal_type=portal_type)
......@@ -99,6 +103,8 @@ class TestMRPMixin(TestBPMMixin):
self.createCategoriesInCategory(category_tool.trade_phase, ['mrp',])
self.createCategoriesInCategory(category_tool.trade_phase.mrp,
['p' + str(i) for i in range(5)]) # phase0 ~ 4
self.createCategoriesInCategory(category_tool.trade_state,
('ready', 'partial', 'done'))
@reindex
def createDefaultOrder(self, transformation=None, business_process=None):
......@@ -157,41 +163,34 @@ class TestMRPMixin(TestBPMMixin):
""" mrp/p2 mrp/3
ready -------- partial_produced ------- done
"""
business_process = self.createBusinessProcess()
business_link_p2 = self.createBusinessLink(business_process)
business_link_p3 = self.createBusinessLink(business_process)
business_state_ready = self.createBusinessState(business_process)
business_state_partial = self.createBusinessState(business_process)
business_state_done = self.createBusinessState(business_process)
# organisations
source_section = self.createOrganisation(title='source_section')
source = self.createOrganisation(title='source')
destination_section = self.createOrganisation(title='destination_section')
destination = self.createOrganisation(title='destination')
business_process.edit(referential_date='stop_date')
business_link_p2.edit(id='p2',
predecessor_value=business_state_ready,
successor_value=business_state_partial,
business_process = self.createBusinessProcess(referential_date='stop_date')
self.createBusinessLink(business_process,
id='p2',
predecessor='trade_state/ready',
successor='trade_state/partial',
quantity=1,
trade_phase=['mrp/p2'],
source_section_value=source_section,
source_value=source,
destination_section_value=destination_section,
destination_value=destination,
)
business_link_p3.edit(id='p3',
predecessor_value=business_state_partial,
successor_value=business_state_done,
destination_value=destination)
self.createBusinessLink(business_process,
id='p3',
predecessor='trade_state/partial',
successor='trade_state/done',
quantity=1,
deliverable=1, # root explanation
trade_phase=['mrp/p3'],
source_section_value=source_section,
source_value=source,
destination_section_value=destination_section,
destination_value=destination,
)
destination_value=destination)
return business_process
@reindex
......@@ -200,62 +199,43 @@ class TestMRPMixin(TestBPMMixin):
ready ======== partial_produced
mrp/p3
"""
business_process = self.createBusinessProcess()
business_link_p2 = self.createBusinessLink(business_process)
business_link_p3 = self.createBusinessLink(business_process)
business_state_ready = self.createBusinessState(business_process)
business_state_partial = self.createBusinessState(business_process)
# organisations
source_section = self.createOrganisation(title='source_section')
source = self.createOrganisation(title='source')
destination_section = self.createOrganisation(title='destination_section')
destination = self.createOrganisation(title='destination')
business_process.edit(referential_date='stop_date')
business_link_p2.edit(id='p2',
predecessor_value=business_state_ready,
successor_value=business_state_partial,
business_process = self.createBusinessProcess(referential_date='stop_date')
self.createBusinessLink(business_process,
id='p2',
predecessor='trade_state/ready',
successor='trade_state/partial',
quantity=1,
trade_phase=['mrp/p2'],
source_section_value=source_section,
source_value=source,
destination_section_value=destination_section,
destination_value=destination,
)
business_link_p3.edit(id='p3',
predecessor_value=business_state_ready,
successor_value=business_state_partial,
destination_value=destination)
self.createBusinessLink(business_process,
id='p3',
predecessor='trade_state/ready',
successor='trade_state/partial',
quantity=1,
deliverable=1, # root explanation
trade_phase=['mrp/p3'],
source_section_value=source_section,
source_value=source,
destination_section_value=destination_section,
destination_value=destination,
)
destination_value=destination)
return business_process
@reindex
def beforeTearDown(self):
super(TestMRPMixin, self).beforeTearDown()
transaction.abort()
for module in (
self.portal.organisation_module,
self.portal.production_order_module,
self.portal.transformation_module,
self.portal.business_process_module,
# don't remove document because reuse it for testing of id
# self.portal.product_module,
self.portal.portal_simulation,):
module.manage_delObjects(list(module.objectIds()))
transaction.commit()
class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
class TestMRPImplementation(TestMRPMixin):
"""the test for implementation"""
@skip('Unfinished experimental feature')
def test_TransformationRule_getHeadProductionPathList(self):
rule = self.portal.portal_rules.default_transformation_model_rule
rule = self.getRule(reference='default_transformation_model_rule')
transformation = self.createDefaultTransformation()
......@@ -279,8 +259,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
path_p3 = '%s/p3' % business_process.getRelativeUrl()
# organisations
path = business_process.objectValues(
portal_type=self.portal.getPortalBusinessLinkTypeList())[0]
path = business_process.p2
source_section = path.getSourceSection()
source = path.getSource()
destination_section = path.getDestinationSection()
......@@ -304,7 +283,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock
applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_model_rule
rule = self.getRule(reference='default_transformation_model_rule')
rule.expand(applied_rule)
# assertion
......@@ -343,8 +322,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
phase_p3 = '%s/p3' % business_process.getRelativeUrl()
# organisations
path = business_process.objectValues(
portal_type=self.portal.getPortalBusinessLinkTypeList())[0]
path = business_process.p2
source_section = path.getSourceSection()
source = path.getSource()
destination_section = path.getDestinationSection()
......@@ -369,7 +347,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock
applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_model_rule
rule = self.getRule(reference='default_transformation_model_rule')
rule.expand(applied_rule)
# assertion
......@@ -412,8 +390,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
phase_p3 = '%s/p3' % business_process.getRelativeUrl()
# organisations
path = business_process.objectValues(
portal_type=self.portal.getPortalBusinessLinkTypeList())[0]
path = business_process.p2
source_section = path.getSourceSection()
source = path.getSource()
destination_section = path.getDestinationSection()
......@@ -431,7 +408,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
movement._baseSetFrozen(1)
# re-expand
rule = self.portal.portal_rules.default_transformation_model_rule
rule = self.getRule(reference='default_transformation_model_rule')
rule.expand(applied_rule)
# assertion
......@@ -510,7 +487,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock
applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_sourcing_model_rule
rule = self.getRule(reference='default_transformation_sourcing_model_rule')
rule.expand(applied_rule)
# assertion
......
......@@ -30,11 +30,12 @@ def Legacy_getBusinessTemplateList(cls):
def Legacy_getBusinessTemplateList(self):
bt_list = []
for bt in getBusinessTemplateList(self):
if bt != 'erp5_simulation_test':
if bt != 'erp5_simulation_test' and bt not in bt_list:
bt_list.append(bt)
if bt == 'erp5_simulation':
bt_list.append(bt + '_legacy')
elif bt in ('erp5_accounting', 'erp5_trade', 'erp5_project'):
elif bt in ('erp5_accounting', 'erp5_mrp',
'erp5_project', 'erp5_trade'):
bt_list.append(bt + '_simulation_legacy')
return tuple(bt_list)
cls.getBusinessTemplateList = Legacy_getBusinessTemplateList
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment