From 7326f7f32809ec5e7173f47f993dcb9ab439f1a6 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Tue, 7 Jul 2009 14:04:33 +0000
Subject: [PATCH] add constraints on TradeModelLine :   - trade_phase is
 mandatory   - if category are defined on line, this line should contain cells

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27998 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../PropertySheet/TradeModelLineConstraint.py     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/product/ERP5/PropertySheet/TradeModelLineConstraint.py b/product/ERP5/PropertySheet/TradeModelLineConstraint.py
index e149ac06a3..fdb1ecb328 100644
--- a/product/ERP5/PropertySheet/TradeModelLineConstraint.py
+++ b/product/ERP5/PropertySheet/TradeModelLineConstraint.py
@@ -47,4 +47,19 @@ class TradeModelLineConstraint:
       'base_category' : ('resource',),
       'message_arity_not_in_range' : 'Service must be defined in lines',
     },
+    { 'id'            : 'trade_phase',
+      'description'   : 'Trade Phase must be defined',
+      'type'          : 'CategoryMembershipArity',
+      'min_arity'     : '1',
+      'max_arity'     : '1',
+      'portal_type'   : ( ),
+      'base_category' : ('trade_phase',),
+      'message_arity_not_in_range' : 'Trade Phase must be defined in lines',
+    },
+    { 'id': 'cell_existence',
+      'description': 'If variation categories are define on Trade Model Line \
+                      cell corresponding to this categories should exist too',
+      'base_id': 'movement',
+      'type': 'TradeModelLineCellConsistency',
+    },
   )
-- 
2.30.9