[Erp5-report] r13288 - /erp5/trunk/products/ERP5/Tool/SimulationTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 8 16:23:35 CET 2007
Author: romain
Date: Thu Mar 8 16:23:34 2007
New Revision: 13288
URL: http://svn.erp5.org?rev=13288&view=rev
Log:
getAvailableTime can filter by resource.
Modified:
erp5/trunk/products/ERP5/Tool/SimulationTool.py
Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=13288&r1=13287&r2=13288&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py Thu Mar 8 16:23:34 2007
@@ -1760,7 +1760,8 @@
security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableTime')
def getAvailableTime(self, from_date=None, to_date=None,
- portal_type=[], node=[], **kw):
+ portal_type=[], node=[],
+ resource=[], src__=0, **kw):
"""
Calculate available time for a node
Returns an inventory of a single or multiple resources on a single
@@ -1772,6 +1773,9 @@
node - only take rows in stock table which node_uid is
equivalent to node
+
+ resource - only take rows in stock table which resource_uid is
+ equivalent to resource
portal_type - only take rows in stock table which portal_type
is in portal_type parameter
@@ -1789,8 +1793,11 @@
to_date=to_date,
portal_type=portal_type,
node=node,
- **kw)[0].total_quantity
- if (result is None) or (result < 0):
+ resource=resource,
+ src__=src__, **kw)[0].total_quantity
+ if src__:
+ return result_list
+ elif (result is None) or (result < 0):
result = 0
return result
@@ -1798,6 +1805,7 @@
'getAvailableTimeSequence')
def getAvailableTimeSequence(self, from_date, to_date,
portal_type=[], node=[],
+ resource=[],
src__=0,
**kw):
"""
@@ -1826,7 +1834,11 @@
period_list=Sequence(from_date, to_date, **kw),
portal_type=portal_type,
node=node,
+ resource=resource,
src__=src__)
+ for x in result_list:
+ if x.total_quantity < 0:
+ x.total_quantity = 0
return result_list
from Products.ERP5Type.DateUtils import addToDate
More information about the Erp5-report
mailing list