From 09289006aba13c5b6fabc5268f4b19f6e6b2d959 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Tue, 11 Mar 2008 13:37:59 +0000 Subject: [PATCH] add some contraints to order: - Source, Destination and Sections must be defined - Total Quantity must not be 0 - Start Date must be defined - Stop Date must be after Start Date git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19790 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/PropertySheet/Order.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/product/ERP5/PropertySheet/Order.py b/product/ERP5/PropertySheet/Order.py index 866515edb3..c59c8ee07f 100644 --- a/product/ERP5/PropertySheet/Order.py +++ b/product/ERP5/PropertySheet/Order.py @@ -77,4 +77,30 @@ class Order: 'portal_type' : ('Applied Rule', ), 'base_category' : ('causality',) }, + { 'id' : 'category_existence', + 'description' : 'Source, Destination and Sections must be defined', + 'type' : 'CategoryExistence', + 'portal_type' : ('Person', 'Organisation'), + 'source' : 1, + 'destination' : 1, + 'source_section': 1, + 'destination_section': 1, + }, + { 'id' : 'total_quantity', + 'description' : 'Total Quantity must not be 0', + 'type' : 'TALESConstraint', + 'expression' : 'python: object.getTotalQuantity() > 0', + 'message_expression_false': 'Total Quantity must not be 0', + }, + { 'id' : 'start_date', + 'description' : 'Start Date must be defined', + 'type' : 'PropertyExistence', + 'start_date' : 1, + }, + { 'id' : 'date_coherency', + 'description' : 'Stop Date must be after Start Date', + 'type' : 'TALESConstraint', + 'expression' : 'python: object.getStopDate() >= object.getStartDate()', + 'message_expression_false': 'Stop Date must be after Start Date', + }, ) -- 2.30.9