From eac7573d51c959eb35ae024810beb663d0294308 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 7 Aug 2014 13:59:52 +0200
Subject: [PATCH] Make it sure to prevent a builder from creating a new
 delivery when it is not allowed.

reapply commit 1761194e67c4be5b2df93086e87639c55d0f9b79 that got lost in the
renaming
---
 product/ERP5/mixin/builder.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/product/ERP5/mixin/builder.py b/product/ERP5/mixin/builder.py
index 6307f8cfbe..ce5e17479a 100644
--- a/product/ERP5/mixin/builder.py
+++ b/product/ERP5/mixin/builder.py
@@ -429,6 +429,10 @@ class BuilderMixin(XMLObject, Amount, Predicate):
         delivery = delivery_to_update_list[0]
 
       if delivery is None:
+        if not self.isDeliveryCreatable():
+          raise SelectMethodError('No updatable delivery found with %s' \
+                  % (self.getPath(),))
+
         delivery = self._createDelivery(delivery_module,
                                         movement_group_node.getMovementList(),
                                         activate_kw)
-- 
2.30.9