[Erp5-report] r43690 jerome - /erp5/trunk/products/ERP5/Document/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 24 17:51:41 CET 2011


Author: jerome
Date: Thu Feb 24 17:51:41 2011
New Revision: 43690

URL: http://svn.erp5.org?rev=43690&view=rev
Log:
Open Orders are not Orders, Open Order Lines are not Order Lines they are simply Paths.

Modified:
    erp5/trunk/products/ERP5/Document/OpenOrder.py
    erp5/trunk/products/ERP5/Document/OpenOrderCell.py
    erp5/trunk/products/ERP5/Document/OpenOrderLine.py

Modified: erp5/trunk/products/ERP5/Document/OpenOrder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OpenOrder.py?rev=43690&r1=43689&r2=43690&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OpenOrder.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/OpenOrder.py [utf8] Thu Feb 24 17:51:41 2011
@@ -31,21 +31,15 @@ import zope.interface
 from AccessControl import ClassSecurityInfo
 
 from Products.ERP5Type import Permissions, PropertySheet, interfaces
-from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
 from Products.ERP5.Document.Supply import Supply
-from Products.ERP5.Document.Order import Order
 
-class OpenOrder(Supply, Order):
+class OpenOrder(Supply):
   """
     An OpenOrder is a collection of Open Order Lines
 
-    TODO:
-    - make sure that this should be (or not) a subclass
-      of Order
   """
   meta_type = 'ERP5 Open Order'
   portal_type = 'Open Order'
-  isPredicate = ConstantGetter('isPredicate', value=True) # XXX - Why ?
 
   # Declarative security
   security = ClassSecurityInfo()
@@ -84,4 +78,4 @@ class OpenOrder(Supply, Order):
                 since only used by one client and tiolive. For tiolive
                 it will be dropped out
     """
-    
\ No newline at end of file
+    

Modified: erp5/trunk/products/ERP5/Document/OpenOrderCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OpenOrderCell.py?rev=43690&r1=43689&r2=43690&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OpenOrderCell.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/OpenOrderCell.py [utf8] Thu Feb 24 17:51:41 2011
@@ -29,16 +29,11 @@
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, PropertySheet
 from Products.ERP5.Document.SupplyCell import SupplyCell
-from Products.ERP5.Document.OrderCell import OrderCell
 
-class OpenOrderCell(SupplyCell, OrderCell):
+class OpenOrderCell(SupplyCell):
     """
-      A OpenOrderCell allows to define specific quantities
+      An Open Order Cell allows to define specific properties
       for each variation of a resource in an Open Order Line.
-
-      TODO:
-      - make sure that this should be (or not) a subclass
-        of OrderCell
     """
     meta_type = 'ERP5 Open Order Cell'
     portal_type = 'Open Order Cell'
@@ -64,3 +59,10 @@ class OpenOrderCell(SupplyCell, OrderCel
                       , PropertySheet.Reference
                       )
 
+    def getTotalPrice(self):
+      """Returns the total price for this open order cell.
+      Unlike Amount, we do not calculate a price implicitly if not defined.
+      Actually, I (jerome) think amount behaviour itself if wrong.
+      """
+      return (self.getQuantity() or 0) * (self.getPrice() or 0)
+

Modified: erp5/trunk/products/ERP5/Document/OpenOrderLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OpenOrderLine.py?rev=43690&r1=43689&r2=43690&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OpenOrderLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/OpenOrderLine.py [utf8] Thu Feb 24 17:51:41 2011
@@ -30,16 +30,12 @@
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, PropertySheet
 from Products.ERP5.Document.SupplyLine import SupplyLine
-from Products.ERP5.Document.OrderLine import OrderLine
 
-class OpenOrderLine(SupplyLine, OrderLine):
+class OpenOrderLine(SupplyLine):
     """
       An Open Order Line is a Supply Line with additional
       properties to define repeatability
 
-      TODO:
-      - make sure that this should be (or not) a subclass
-        of OrderLine
     """
     meta_type = 'ERP5 Open Order Line'
     portal_type = 'Open Order Line'
@@ -66,3 +62,24 @@ class OpenOrderLine(SupplyLine, OrderLin
                       , PropertySheet.Comment
                       )
 
+    def getTotalQuantity(self, default=0):
+      """Returns the total quantity for this open order line.
+      If the order line contains cells, the total quantity of cells are
+      returned.
+      """
+      if self.hasCellContent(base_id='path'):
+        return sum([cell.getQuantity() for cell in
+                      self.getCellValueList(base_id='path')])
+      return self.getQuantity(default)
+
+    def getTotalPrice(self):
+      """Returns the total price for this open order line.
+      If the order line contains cells, the total price of cells are
+      returned.
+      """
+      if self.hasCellContent(base_id='path'):
+        return sum([cell.getTotalPrice() for cell in
+                      self.getCellValueList(base_id='path')])
+      return SupplyLine.getTotalPrice(self)
+
+



More information about the Erp5-report mailing list