From a9bff219dc64ccb4e3ad78190e42776000bd51bd Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 24 Dec 2004 17:28:45 +0000
Subject: [PATCH] make it working

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2116 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/InvoicingRule.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/product/ERP5/Document/InvoicingRule.py b/product/ERP5/Document/InvoicingRule.py
index 998a187a10..ce6cd4c7a6 100755
--- a/product/ERP5/Document/InvoicingRule.py
+++ b/product/ERP5/Document/InvoicingRule.py
@@ -87,7 +87,7 @@ class InvoicingRule(Rule):
       LOG('InvoicingRule.expand, my_context_movement.getSource()',0,my_context_movement.getSource())
       LOG('InvoicingRule.expand, my_context_movement.getTargetSource()',0,my_context_movement.getTargetSource())
       LOG('InvoicingRule.expand, my_context_movement.showDict()',0,my_context_movement.showDict())
-      LOG('InvoicingRule.expand, my_context_movement.getTargetSource',0,my_context_movement.getTargetSource)
+      LOG('InvoicingRule.expand, my_context_movement.getSource',0,my_context_movement.getSource())
       if my_context_movement.getSource() is not None:
         # We should only expand movements if they have a source
         # otherwise, it creates infinite recursion
@@ -95,16 +95,15 @@ class InvoicingRule(Rule):
         # from an order which is deleted afterwards
         # LOG('Sourcing', 0, str(my_context_movement.getDefaultResource()))
         new_id = 'invoice_line'
-        transformation_source = getattr(aq_base(applied_rule), new_id, None)
-        if transformation_source is None:
+        if new_id in applied_rule.objectIds():
+          transformation_source = applied_rule[new_id]
+        else:
           transformation_source = applied_rule.newContent(
                 type_name = delivery_line_type,
                 id = new_id
               )
 
-        #resource = my_context_movement.getResource()
-        #if resource.find('operation/') >= 0:
-          # This is an operation - produce it
+        resource = my_context_movement.getResource()
         transformation_source._edit(
                 target_quantity = my_context_movement.getTargetQuantity(),
                 target_efficiency = my_context_movement.getTargetEfficiency(),
-- 
2.30.9