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

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 30 08:37:02 CET 2010


Author: arnaud.fontaine
Date: Tue Nov 30 08:37:02 2010
New Revision: 40903

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

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

Copied: erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py (from r40897, erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueFeasability.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py?p2=erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py&p1=erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueFeasability.py&r1=40897&r2=40903&rev=40903&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Constraint/TransactionQuantityValueFeasability.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py [utf8] Tue Nov 30 08:37:02 2010
@@ -26,26 +26,40 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Constraint import Constraint
+from Products.ERP5Type.mixin.constraint import ConstraintMixin
+from Products.ERP5Type import PropertySheet
 
-class TransactionQuantityValueFeasability(Constraint):
+class TransactionQuantityValueFeasabilityConstraint(ConstraintMixin):
     """
     Check if the quantity of the transaction is possible
     for the source and the destination
+
+    This is only relevant for ZODB Property Sheets (filesystem Property
+    Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueFeasability
+    instead).
     """
+    meta_type = 'ERP5 Transaction Quantity Value Feasability Constraint'
+    portal_type = 'Transaction Quantity Value Feasability Constraint'
+
+    property_sheets = (PropertySheet.SimpleItem,
+                       PropertySheet.Predicate,
+                       PropertySheet.Reference)
 
     def checkConsistency(self, object, fixit=0):
       """
       Check if the quantity of the transaction is possible
       for the source and the destination
       """
+      if not self.test(object):
+          return []
+
       errors = []
       source_cell = object.getSourceValue()
       destination_cell = object.getDestinationValue()
       # Check for source and destination
-      for node, sign, node_title in ((source_cell, 1, 'source'), 
+      for node, sign, node_title in ((source_cell, 1, 'source'),
                                      (destination_cell, -1, 'destination')):
-        # As the quantity can change a few lines letter, 
+        # As the quantity can change a few lines letter,
         # we need to get it each time.
         object_quantity = object.getQuantity()
         quantity = object_quantity * sign



More information about the Erp5-report mailing list