Commit 92ebdac3 authored by Julien Muchembled's avatar Julien Muchembled

Revert [41260] (which is WIP and was committed by mistake)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41265 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4190908e
...@@ -187,7 +187,8 @@ class BusinessProcess(Path, XMLObject): ...@@ -187,7 +187,8 @@ class BusinessProcess(Path, XMLObject):
raise ValueError('explanation must not be a Root Applied Rule') raise ValueError('explanation must not be a Root Applied Rule')
trade_date = trade_model_path.getTradeDate() trade_date = trade_model_path.getTradeDate()
assert trade_date, 'a trade_date must be defined on the Trade Model Path' if not trade_date:
raise ValueError('a trade_date must be defined on every Trade Model Path')
reference_date_method_id = trade_model_path.getReferenceDateMethodId() reference_date_method_id = trade_model_path.getReferenceDateMethodId()
if not reference_date_method_id: if not reference_date_method_id:
...@@ -800,10 +801,10 @@ class BusinessProcess(Path, XMLObject): ...@@ -800,10 +801,10 @@ class BusinessProcess(Path, XMLObject):
# applied rules which are not root applied rules. # applied rules which are not root applied rules.
# XXX-JPS could be extended with a rule property instead # XXX-JPS could be extended with a rule property instead
# of supports only in root applied rule case # of supports only in root applied rule case
if trade_model_path.getTradeDate(): start_date, stop_date = self.getExpectedTradeModelPathStartAndStopDate(
property_dict['start_date'], property_dict['stop_date'] = \
self.getExpectedTradeModelPathStartAndStopDate(
explanation, trade_model_path, delay_mode=delay_mode) explanation, trade_model_path, delay_mode=delay_mode)
property_dict['start_date'] = start_date
property_dict['stop_date'] = stop_date
else: else:
raise TypeError("Explanation must be an Applied Rule in expand process") # Nothing to do raise TypeError("Explanation must be an Applied Rule in expand process") # Nothing to do
return property_dict return property_dict
......
...@@ -47,45 +47,22 @@ class TestTaskReporting(ERP5ReportTestCase): ...@@ -47,45 +47,22 @@ class TestTaskReporting(ERP5ReportTestCase):
@reindex @reindex
def _makeOneTask(self, simulation_state='planned', **kw): def _makeOneTask(self, simulation_state='planned', **kw):
"""Create a task, support many options""" """Create a task, support many options"""
task = self.portal.task_module.newContent(portal_type='Task', task_module = self.getPortalObject().task_module
specialise=self.business_process) task = task_module.newContent(portal_type='Task', **kw)
task._edit(**kw)
if simulation_state == 'planned': if simulation_state == 'planned':
task.plan() task.plan()
if simulation_state == 'confirmed': if simulation_state == 'confirmed':
task.confirm() task.confirm()
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
def createBusinessProcess(self):
module = self.portal.business_process_module
id = self.__class__.__name__
try:
business_process = module[id]
except KeyError:
default = module.erp5_default_business_process
business_process = module.newContent(id, default.getPortalType(),
specialise_value=default)
delivery_path, = default.getTradeModelPathValueList(
trade_phase='default/delivery')
business_process.newContent(portal_type=delivery_path.getPortalType(),
reference=delivery_path.getReference(),
trade_phase=delivery_path.getTradePhase())
return business_process.getRelativeUrl()
def afterSetUp(self): def afterSetUp(self):
"""Setup the fixture. """Setup the fixture.
""" """
for rule_id in ('default_order_rule', self.portal = self.getPortal()
'default_delivery_rule',
'default_delivering_rule'):
rule = self.getRule(reference=rule_id)
if rule.getValidationState() != 'validated':
rule.validate()
self.business_process = self.createBusinessProcess() for rule_id in ['default_order_rule', 'default_delivery_rule']:
rule = getattr(self.portal.portal_rules, rule_id)
if rule.getValidationState() == 'draft':
rule.validate()
# create organisations # create organisations
if not self.portal.organisation_module.has_key('Organisation_1'): if not self.portal.organisation_module.has_key('Organisation_1'):
...@@ -176,13 +153,15 @@ class TestTaskReporting(ERP5ReportTestCase): ...@@ -176,13 +153,15 @@ class TestTaskReporting(ERP5ReportTestCase):
"""Remove all documents. """Remove all documents.
""" """
transaction.abort() transaction.abort()
portal = self.portal
portal = self.getPortal()
portal.task_module.manage_delObjects( portal.task_module.manage_delObjects(
list(portal.task_module.objectIds())) list(portal.task_module.objectIds()))
portal.task_report_module.manage_delObjects( portal.task_report_module.manage_delObjects(
list(portal.task_report_module.objectIds())) list(portal.task_report_module.objectIds()))
portal.portal_simulation.manage_delObjects( portal.portal_simulation.manage_delObjects(
list(portal.portal_simulation.objectIds())) list(portal.portal_simulation.objectIds()))
transaction.commit() transaction.commit()
self.tic() self.tic()
......
...@@ -32,8 +32,6 @@ from Products.ERP5.tests.testProject import * ...@@ -32,8 +32,6 @@ from Products.ERP5.tests.testProject import *
test_suite_list.append(test_suite) test_suite_list.append(test_suite)
from Products.ERP5.tests.testTask import * from Products.ERP5.tests.testTask import *
test_suite_list.append(test_suite) test_suite_list.append(test_suite)
from Products.ERP5.tests.testTaskReporting import *
test_suite_list.append(test_suite)
from Products.ERP5.tests.testTaskReportDivergence import * from Products.ERP5.tests.testTaskReportDivergence import *
test_suite_list.append(test_suite) test_suite_list.append(test_suite)
...@@ -45,10 +43,6 @@ Legacy_getBusinessTemplateList(TestProject) ...@@ -45,10 +43,6 @@ Legacy_getBusinessTemplateList(TestProject)
TestTaskMixin.business_process = None TestTaskMixin.business_process = None
Legacy_getBusinessTemplateList(TestTaskMixin) Legacy_getBusinessTemplateList(TestTaskMixin)
TestTaskReporting.createBusinessProcess = lambda self: None
Legacy_getBusinessTemplateList(TestTaskReporting)
def test_suite(): def test_suite():
suite = test_suite_list[0]() suite = test_suite_list[0]()
for test_suite in test_suite_list[1:]: for test_suite in test_suite_list[1:]:
......
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