From 972f705f53e7e588b3550f6385af5854f4090d60 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Sat, 12 Sep 2015 00:46:16 +0900
Subject: [PATCH] Tester decision movement can be a SM.

Followup of 4b664ba: When comparing Trade Model Rule input_movement from
AmountGenerator and decision which is a Simulation Movement.

This fixes test_13_AddAllowanceForOutsourcingOrder.
---
 product/ERP5/Document/NetConvertedQuantityEquivalenceTester.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/NetConvertedQuantityEquivalenceTester.py b/product/ERP5/Document/NetConvertedQuantityEquivalenceTester.py
index 176c08ce3f..a463374502 100644
--- a/product/ERP5/Document/NetConvertedQuantityEquivalenceTester.py
+++ b/product/ERP5/Document/NetConvertedQuantityEquivalenceTester.py
@@ -57,7 +57,8 @@ class NetConvertedQuantityEquivalenceTester(FloatEquivalenceTester):
     # XXX: QuantityDivergenceTester from Legacy Simulation: A delivery
     # quantity of 0 is an exceptional case that we cannot really handle with
     # the current approach of delivery ratio.
-    if decision_value == 0.0:
+    if (decision_movement.getPortalType() != 'Simulation Movement' and
+        decision_value == 0.0):
       prevision_value = sum([
         sm.getMappedProperty('corrected_quantity')
         for sm in decision_movement.getDeliveryRelatedValueList(
-- 
GitLab