Commit aa9e58d8 authored by Jérome Perrin's avatar Jérome Perrin

use at_date parameter explicitly in method signatures and propagate it also in

getAvailableBudget


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27975 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dae8e421
......@@ -83,22 +83,26 @@ class BudgetCell(Predicate, MetaNode):
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 @@ class BudgetCell(Predicate, MetaNode):
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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment