From d958b1a1ab93594255ed4bd5ef0fd3b7c3285e2d Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Tue, 4 Feb 2014 17:28:50 +0100
Subject: [PATCH] MRP: add compatibility code for unit tests that wrongly use
 'industrial_phase'

---
 product/ERP5/Document/Amount.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/Amount.py b/product/ERP5/Document/Amount.py
index c9417b5dfd..520574198b 100644
--- a/product/ERP5/Document/Amount.py
+++ b/product/ERP5/Document/Amount.py
@@ -91,7 +91,12 @@ class Amount(Base, VariatedMixin):
       return []
     variation_list = resource.getVariationBaseCategoryList(
         omit_optional_variation=omit_optional_variation)
-    variation_list.append('industrial_phase')
+    # BBB: 'industrial_phase' should be used exclusively for production and
+    #      should not appear on resource. But many unit tests still use it.
+    #      For the same reason, we treat as an optional variation.
+    if ('industrial_phase' not in variation_list
+        and not omit_optional_variation):
+      variation_list.append('industrial_phase')
     if base_category_list:
       variation_list = filter(base_category_list.__contains__, variation_list)
     return self.getAcquiredCategoryMembershipList(variation_list, base=1)
-- 
2.30.9