Commit 12f5ef1c authored by Jérome Perrin's avatar Jérome Perrin

configurator: Allow setting more business process properties

Add support for membership criterion, to be able to define advanced trade model
paths with predicates.
parent 21829be8
...@@ -126,8 +126,15 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -126,8 +126,15 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def _addTradeModelPath(self, business_process, title, trade_phase, def _addTradeModelPath(
trade_date, **kw): self,
business_process,
title,
trade_phase,
trade_date,
membership_criterion_base_category_list=None,
membership_criterion_category_list=None,
**kw):
""" Add a trade model path to the business process. """ Add a trade model path to the business process.
""" """
reference = "TMP-%s" % "-".join(title.upper().strip().split(" ")) reference = "TMP-%s" % "-".join(title.upper().strip().split(" "))
...@@ -142,6 +149,13 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -142,6 +149,13 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject):
if trade_date is not None: if trade_date is not None:
trade_model_path.setTradeDate('trade_phase/%s' % trade_date) trade_model_path.setTradeDate('trade_phase/%s' % trade_date)
if membership_criterion_base_category_list:
trade_model_path.setMembershipCriterionBaseCategoryList(
membership_criterion_base_category_list.split(","))
if membership_criterion_category_list:
trade_model_path.setMembershipCriterionCategoryList(
membership_criterion_category_list.split(","))
def _addBusinessLink(self, business_process, title, trade_phase, predecessor, def _addBusinessLink(self, business_process, title, trade_phase, predecessor,
successor, delivery_builder, **kw): successor, delivery_builder, **kw):
link_id = "%s_link" % "_".join(title.lower().strip().split(" ")) link_id = "%s_link" % "_".join(title.lower().strip().split(" "))
......
...@@ -551,13 +551,8 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): ...@@ -551,13 +551,8 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin):
self.assertEqual(invoicing_path.getTradePhase(), 'trade/invoicing') self.assertEqual(invoicing_path.getTradePhase(), 'trade/invoicing')
self.assertEqual(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery') self.assertEqual(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery')
self.assertEqual(invoicing_path.getTestMethodId(), None) self.assertEqual(invoicing_path.getTestMethodId(), None)
self.assertEqual(invoicing_path.getMembershipCriterionBaseCategoryList(), [])
accounting_credit_path = getattr(business_process, "accounting_credit_path", None) self.assertEqual(invoicing_path.getMembershipCriterionCategoryList(), [])
self.assertNotEquals(accounting_credit_path, None)
self.assertEqual(accounting_credit_path.getEfficiency(), -1.0)
self.assertEqual(accounting_credit_path.getTradePhase(), 'trade/accounting')
self.assertEqual(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing')
self.assertEqual(accounting_credit_path.getTestMethodId(), "isAccountingMovementType")
accounting_debit_path = getattr(business_process, "accounting_debit_path", None) accounting_debit_path = getattr(business_process, "accounting_debit_path", None)
self.assertNotEquals(accounting_debit_path, None) self.assertNotEquals(accounting_debit_path, None)
...@@ -565,6 +560,25 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): ...@@ -565,6 +560,25 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin):
self.assertEqual(accounting_debit_path.getTradePhase(), 'trade/accounting') self.assertEqual(accounting_debit_path.getTradePhase(), 'trade/accounting')
self.assertEqual(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing') self.assertEqual(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing')
self.assertEqual(accounting_debit_path.getTestMethodId(), "isAccountingMovementType") self.assertEqual(accounting_debit_path.getTestMethodId(), "isAccountingMovementType")
self.assertEqual(
accounting_debit_path.getMembershipCriterionBaseCategoryList(),
['trade_phase'])
self.assertEqual(
accounting_debit_path.getMembershipCriterionCategoryList(),
['trade_phase/trade/invoicing', 'trade_phase/trade/delivery',])
accounting_credit_path = getattr(business_process, "accounting_credit_path", None)
self.assertNotEquals(accounting_credit_path, None)
self.assertEqual(accounting_credit_path.getEfficiency(), -1.0)
self.assertEqual(accounting_credit_path.getTradePhase(), 'trade/accounting')
self.assertEqual(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing')
self.assertEqual(accounting_credit_path.getTestMethodId(), "isAccountingMovementType")
self.assertEqual(
accounting_credit_path.getMembershipCriterionBaseCategoryList(),
['trade_phase'])
self.assertEqual(
accounting_credit_path.getMembershipCriterionCategoryList(),
['trade_phase/trade/delivery',])
order_link = getattr(business_process, "order_link", None) order_link = getattr(business_process, "order_link", None)
self.assertNotEquals(order_link, None) self.assertNotEquals(order_link, None)
......
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