Commit b8f9ecb7 authored by Łukasz Nowak's avatar Łukasz Nowak

- use order link to match simulation movements with prevision for root rules, remove fixed todos

 - be consistent - use _list for order and delivery category property


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28417 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b43b8b9e
......@@ -38,8 +38,6 @@ class BPMDeliveryRule(BPMRule):
DISCLAIMER: Refer to BPMRule docstring disclaimer.
This is BPM enabled Delivery Rule.
FIXME: override _getCompensatedMovementList to match per order link
"""
# CMF Type Definition
......@@ -64,7 +62,7 @@ class BPMDeliveryRule(BPMRule):
business_path, current_property_dict):
"""Delivery specific update dict"""
return {
'order_value': movement,
'delivery_value': movement,
'order_list': [movement.getRelativeUrl()],
'delivery_list': [movement.getRelativeUrl()],
'deliverable': 1,
}
......@@ -38,8 +38,6 @@ class BPMOrderRule(BPMDeliveryRule):
DISCLAIMER: Refer to BPMRule docstring disclaimer.
This is BPM enabled Order Rule.
FIXME: override _getCompensatedMovementList to match per order link
"""
# CMF Type Definition
meta_type = 'ERP5 BPM Order Rule'
......@@ -63,6 +61,6 @@ class BPMOrderRule(BPMDeliveryRule):
business_path, current_property_dict):
"""Order rule specific update dictionary"""
return {
'order_value': movement,
'order_list': [movement.getRelativeUrl()],
'deliverable': 1,
}
......@@ -260,11 +260,17 @@ class BPMRule(Predicate, XMLObject):
for prevision in prevision_list:
p_matched_list = []
for movement in non_matched_list:
for prop in self.getMatchingPropertyList():
if prevision.get(prop) != movement.getProperty(prop):
break
if 'order_list' in prevision:
# applied rule is root, use order link to find movement
if movement.getOrder() == prevision.get('order_list', [''])[0]:
p_matched_list.append(movement)
else:
p_matched_list.append(movement)
# applied rule is not root one, match
for prop in self.getMatchingPropertyList():
if prevision.get(prop) != movement.getProperty(prop):
break
else:
p_matched_list.append(movement)
# Movements exist, we'll try to make them match the prevision
if p_matched_list != []:
......
......@@ -39,6 +39,12 @@ It is advised to *NOT* remove erp5_administration.
TODOs:
* avoid duplication of code when possible
* implement tests wisely, to support at least both BPM cases
Scenarios to cover:
* unify root rules (BPMOrderRule, BPMDeliveryRule, etc) tests - they share
a lot of code
* test case of splitting for root rules
"""
import unittest
......@@ -304,9 +310,6 @@ class TestOrder(TestBPMEvaluationMixin):
self._checkOrderBPMSimulation()
def test_planning_line_edit_add_same_resource_than_order(self):
# TODO: this test fails because BPMOrderRule do not matches movement using
# order link, this have to be done in similar way like OrderRule and
# DeliveryRule work
self.test_planning_line_edit_add_same_resource()
self.order.order()
self.stepTic()
......
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