[Erp5-report] r37120 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/BusinessPath.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jul 15 10:12:04 CEST 2010
Author: nicolas.dumazet
Date: Thu Jul 15 10:11:53 2010
New Revision: 37120
URL: http://svn.erp5.org?rev=37120&view=rev
Log:
implement BusinessPath.getBuildableMovementList
Modified:
erp5/trunk/products/ERP5/Document/BusinessPath.py
Modified: erp5/trunk/products/ERP5/Document/BusinessPath.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessPath.py?rev=37120&r1=37119&r2=37120&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] Thu Jul 15 10:11:53 2010
@@ -582,6 +582,32 @@ class BusinessPath(Path, Predicate):
return successor_expected_date
security.declareProtected(Permissions.AccessContentsInformation,
+ 'getBuildableMovementList')
+ def getBuildableMovementList(self, **sql_kw):
+ """
+ Query catalog to find a list of movements related to this Business Path.
+
+ Filter the results to return only Buildable Movements
+
+ To specialize your builder, you can pass along SQL keywords
+ in sql_kw, for instance:
+ search_kw = {}
+ search_kw['movement.quantity'] = {'query':0, 'range':'neq'}
+ search_kw['movement.price'] = {'query':0, 'range':'neq'}
+ sql_kw = portal_catalog.buildSQLQuery(**search_kw)
+ """
+ all_movement_list = self.BusinessPath_zSelectMovement(
+ business_path_uid=self.getUid(),
+ **sql_kw)
+
+ # select method should return only non-delivered movements, but
+ # maybe movements have been built in the meantime & catalog wasnt updated?
+ non_delivered_movement_list = filter(lambda x:x.getDeliveryValue() is None,
+ all_movement_list)
+
+ return self.filterBuildableMovementList(non_delivered_movement_list)
+
+ security.declareProtected(Permissions.AccessContentsInformation,
'filterBuildableMovementList')
def filterBuildableMovementList(self, non_delivered_movement_list):
"""
More information about the Erp5-report
mailing list