From a0b3510145bbf7a346d8d2539e8a3de621439ce2 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Fri, 16 Dec 2011 11:11:58 +0100
Subject: [PATCH] Always define the portal variable.

---
 product/ERP5/Document/InvoiceTransactionSimulationRule.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/product/ERP5/Document/InvoiceTransactionSimulationRule.py b/product/ERP5/Document/InvoiceTransactionSimulationRule.py
index 13663f0b51..3bad5b381c 100644
--- a/product/ERP5/Document/InvoiceTransactionSimulationRule.py
+++ b/product/ERP5/Document/InvoiceTransactionSimulationRule.py
@@ -103,6 +103,7 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
     #  * price_currency from the top level simulation movement's
     # orderValue
     resource = input_movement.getPriceCurrency()
+    portal = input_movement.getPortalObject()
     if resource is None:
       invoice_line = input_movement.getDeliveryValue()
       if invoice_line is None:
@@ -111,7 +112,6 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
         invoice = invoice_line.getExplanationValue()
         resource = invoice.getProperty('resource',
                     invoice.getProperty('price_currency', None))
-      portal = input_movement.getPortalObject()
       if resource is None:
         # search the resource on parents simulation movement's deliveries
         simulation_movement = input_movement
-- 
2.30.9