From 4d978464a9d8c45a501dc27a6c6122f6d3d2dc70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Fri, 27 Mar 2009 11:00:32 +0000
Subject: [PATCH]  - do not allow to use more than one key in property dict in
 set of movement groups

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26180 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/OrderBuilder.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/OrderBuilder.py b/product/ERP5/Document/OrderBuilder.py
index 0f833bb1b7..3578c6a559 100644
--- a/product/ERP5/Document/OrderBuilder.py
+++ b/product/ERP5/Document/OrderBuilder.py
@@ -40,6 +40,7 @@ from Acquisition import aq_parent, aq_inner
 
 class CollectError(Exception): pass
 class MatrixError(Exception): pass
+class DuplicatedPropertyDictKeysError(Exception): pass
 
 class OrderBuilder(XMLObject, Amount, Predicate):
   """
@@ -259,7 +260,11 @@ class OrderBuilder(XMLObject, Amount, Predicate):
     property_dict = {}
     if not len(instance_list):
       for movement_group_node in movement_group_node_list:
-        property_dict.update(movement_group_node.getGroupEditDict())
+        for k,v in movement_group_node.getGroupEditDict().iteritems():
+          if k in property_dict:
+            raise DuplicatedPropertyDictKeysError(k)
+          else:
+            property_dict[k] = v
     else:
       # we want to check the original delivery first.
       # so sort instance_list by that current is exists or not.
-- 
2.30.9