Commit 80435c62 authored by Fabien Morin's avatar Fabien Morin

add getPrice and getTotalPrice method. Inheritate from TradeModelLine.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27263 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 595248f2
...@@ -31,12 +31,12 @@ from AccessControl import ClassSecurityInfo ...@@ -31,12 +31,12 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.TradeModelLine import TradeModelLine
from Products.ERP5.Document.MappedValue import MappedValue from Products.ERP5.Document.MappedValue import MappedValue
import zope.interface import zope.interface
class TradeModelCell(Amount, MappedValue): class TradeModelCell(TradeModelLine, MappedValue):
"""Trade Model Line """Trade Model Line
""" """
meta_type = 'ERP5 Trade Model Cell' meta_type = 'ERP5 Trade Model Cell'
...@@ -78,4 +78,17 @@ class TradeModelCell(Amount, MappedValue): ...@@ -78,4 +78,17 @@ class TradeModelCell(Amount, MappedValue):
current_aggregated_amount_list = None, **kw): current_aggregated_amount_list = None, **kw):
raise NotImplementedError('TODO') raise NotImplementedError('TODO')
security.declareProtected(Permissions.AccessContentsInformation,
'getPrice')
def getPrice(self):
return self._baseGetPrice()
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalPrice')
def getTotalPrice(self):
"""
Returns the totals price for this line
"""
quantity = self.getQuantity() or 0.0
price = self.getPrice() or 0.0
return quantity * price
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