[Erp5-report] r40907 arnaud.fontaine - /erp5/trunk/products/ERP5/Document/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 30 08:58:32 CET 2010


Author: arnaud.fontaine
Date: Tue Nov 30 08:58:32 2010
New Revision: 40907

URL: http://svn.erp5.org?rev=40907&view=rev
Log:
Add Transaction Quantity Value Validity Constraint for ZODB Property Sheets

Added:
    erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py
      - copied, changed from r40897, erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueValidity.py

Copied: erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py (from r40897, erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueValidity.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py?p2=erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py&p1=erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueValidity.py&r1=40897&r2=40907&rev=40907&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueValidity.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py [utf8] Tue Nov 30 08:58:32 2010
@@ -26,18 +26,30 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Constraint import Constraint
+from Products.ERP5Type.mixin.constraint import ConstraintMixin
+from Products.ERP5Type import PropertySheet
 
-class TransactionQuantityValueValidity(Constraint):
+class TransactionQuantityValueValidityConstraint(ConstraintMixin):
     """
-      Explain here what this constraint checker does
+    This is only relevant for ZODB Property Sheets (filesystem Property
+    Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueValidity
+    instead).
     """
+    meta_type = 'ERP5 Transaction Quantity Value Validity Constraint'
+    portal_type = 'Transaction Quantity Value Validity Constraint'
+
+    property_sheets = (PropertySheet.SimpleItem,
+                       PropertySheet.Predicate,
+                       PropertySheet.Reference)
 
     def checkConsistency(self, object, fixit=0):
       """
-      Check if the quantity of the transaction is greater than the 
+      Check if the quantity of the transaction is greater than the
       balance of the source.
       """
+      if not self.test(object):
+          return []
+
       errors = []
 
       source_cell = object.getSourceValue()



More information about the Erp5-report mailing list