From cfd4b7866891a3b0bbe92b04da695195eff2d441 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 22 Apr 2010 11:46:07 +0000
Subject: [PATCH] In Invoice Simulation Rule, source should be
 source_administration of the input movement or its order's source. Same for
 destination.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34722 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Legacy/Document/InvoicingRule.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/product/ERP5Legacy/Document/InvoicingRule.py b/product/ERP5Legacy/Document/InvoicingRule.py
index be76f6231d..f81433ee0a 100644
--- a/product/ERP5Legacy/Document/InvoicingRule.py
+++ b/product/ERP5Legacy/Document/InvoicingRule.py
@@ -74,6 +74,19 @@ class InvoicingRule(Rule):
   def isDeliverable(self, movement):
     return movement.getResource() is not None
 
+  def _getExpandablePropertyUpdateDict(self, applied_rule, movement,
+      business_path, current_property_dict):
+    """
+    In Invoice Simulation Rule, source should be source_administration
+    of the input movement or its order's source. Same for destination.
+    """
+    root_simulation_movement = movement.getRootSimulationMovement()
+    source = movement.getSourceAdministration() or \
+             root_simulation_movement.getSource()
+    destination = movement.getDestinationAdministration() or \
+                  root_simulation_movement.getDestination()
+    return {'source':source, 'destination':destination}
+
   security.declareProtected(Permissions.AccessContentsInformation,
                             'getExpandablePropertyList')
   def getExpandablePropertyList(self, default=None):
-- 
2.30.9