From 39a812b4467fdad2d1c80511d1acf3f55aa8bd2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 15 May 2008 14:28:35 +0000
Subject: [PATCH] Use glossary terms in constraint messages, and split the
 general constraint for source, source_section, destination and
 destination_section in 4 constraints to have better messages.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20981 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/PropertySheet/TradeOrder.py | 27 ++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/PropertySheet/TradeOrder.py b/product/ERP5/PropertySheet/TradeOrder.py
index 36e499e00d..d896d715f2 100644
--- a/product/ERP5/PropertySheet/TradeOrder.py
+++ b/product/ERP5/PropertySheet/TradeOrder.py
@@ -39,14 +39,33 @@ class TradeOrder:
   )
 
   _constraints = (
-    { 'id'            : 'category_existence',
-      'description'   : 'Source, Destination and Sections must be defined',
+    { 'id'            : 'source_section_category_existence',
+      'description'   : 'Source section must be defined',
       'type'          : 'CategoryExistence',
       'portal_type'   : ('Person', 'Organisation'),
-      'source'        : 1,
-      'destination'        : 1,
       'source_section': 1,
+      'message': 'Supplier must be defined',
+    },
+    { 'id'            : 'destination_section_category_existence',
+      'description'   : 'Destination section must be defined',
+      'type'          : 'CategoryExistence',
+      'portal_type'   : ('Person', 'Organisation'),
       'destination_section': 1,
+      'message': 'Client must be defined',
+    },
+    { 'id'            : 'source_category_existence',
+      'description'   : 'Source must be defined',
+      'type'          : 'CategoryExistence',
+      'portal_type'   : ('Person', 'Organisation'),
+      'source': 1,
+      'message': 'Sender or Provider must be defined',
+    },
+    { 'id'            : 'destination_category_existence',
+      'description'   : 'Destination must be defined',
+      'type'          : 'CategoryExistence',
+      'portal_type'   : ('Person', 'Organisation'),
+      'destination': 1,
+      'message': 'Recipient or Beneficiary must be defined',
     },
     { 'id'            : 'total_quantity',
       'description'   : 'Total Quantity must not be 0',
-- 
2.30.9