From 1761194e67c4be5b2df93086e87639c55d0f9b79 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Fri, 17 Sep 2010 06:51:21 +0000
Subject: [PATCH] Make it sure to prevent a builder from creating a new
 delivery when it is not allowed.

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

diff --git a/product/ERP5/Document/OrderBuilder.py b/product/ERP5/Document/OrderBuilder.py
index 29322e352c..b7c37dad51 100644
--- a/product/ERP5/Document/OrderBuilder.py
+++ b/product/ERP5/Document/OrderBuilder.py
@@ -440,6 +440,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
         delivery = delivery_to_update_list[0]
 
       if delivery is None:
+        if not self.getDeliveryCreatable():
+          raise SelectMethodError('No updatable delivery found with %s' \
+                  % (self.getPath(),))
         delivery = self._createDelivery(delivery_module,
                                         movement_group_node.getMovementList(),
                                         activate_kw)
-- 
2.30.9