[Erp5-report] r27975 - /erp5/trunk/products/ERP5/Document/BudgetCell.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jul 6 16:38:34 CEST 2009
Author: jerome
Date: Mon Jul 6 16:38:33 2009
New Revision: 27975
URL: http://svn.erp5.org?rev=27975&view=rev
Log:
use at_date parameter explicitly in method signatures and propagate it also in
getAvailableBudget
Modified:
erp5/trunk/products/ERP5/Document/BudgetCell.py
Modified: erp5/trunk/products/ERP5/Document/BudgetCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BudgetCell.py?rev=27975&r1=27974&r2=27975&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BudgetCell.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BudgetCell.py [utf8] Mon Jul 6 16:38:33 2009
@@ -83,22 +83,26 @@
self.getPortalType()
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory')
- def getCurrentInventory(self, **kw):
- """
- Returns current inventory
+ def getCurrentInventory(self, at_date=None, **kw):
+ """ Returns current inventory.
+
+ at_date parameter can be used to take into account budget transactions
+ before that date.
"""
kw['node_uid'] = self.getUid()
resource = self.getResourceValue()
if resource is not None:
kw['resource_uid'] = resource.getUid()
+ if at_date:
+ kw['at_date'] = at_date
return self.portal_simulation.getCurrentInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentBalance')
- def getCurrentBalance(self, **kw):
+ def getCurrentBalance(self, at_date=None):
"""
Returns current balance
"""
- return self.getQuantity(0.0) + self.getCurrentInventory(**kw)
+ return self.getQuantity(0.0) + self.getCurrentInventory(at_date=at_date)
security.declareProtected(Permissions.AccessContentsInformation, 'getConsumedBudget')
def getConsumedBudget(self, src__=0):
@@ -113,11 +117,11 @@
self.getPortalType()
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableBudget')
- def getAvailableBudget(self):
+ def getAvailableBudget(self, at_date=None):
"""
Return available budget.
"""
- return self.getCurrentBalance() - self.getEngagedBudget()
+ return self.getCurrentBalance(at_date=at_date) - self.getEngagedBudget()
security.declareProtected(Permissions.AccessContentsInformation, 'getEngagedBudget')
def getEngagedBudget(self, src__=0):
More information about the Erp5-report
mailing list