Commit 680c911c authored by Vincent Pelletier's avatar Vincent Pelletier

Implement getTotalNetPrice.

Activate unit test (was commented out unitl now).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20778 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dd3dc352
......@@ -130,6 +130,16 @@ class Delivery(XMLObject, ImmobilisationDelivery):
aggregate = self.Delivery_zGetTotal(**kw)[0]
return aggregate.total_price or 0
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalNetPrice')
def getTotalNetPrice(self, fast=0, src__=0, **kw):
"""
Same as getTotalPrice, but including Tax and Discount.
"""
total_price = self.getTotalPrice(fast=fast, src__=src__, **kw)
kw['portal_type'] = self.getPortalTaxMovementTypeList()
return total_price + self.getTotalPrice(fast=fast, src__=src__, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
def getTotalQuantity(self, fast=0, src__=0, **kw):
......
......@@ -63,23 +63,15 @@ class Invoice(AccountingTransaction):
Permissions.AccessContentsInformation, 'getTotalPrice')
def getTotalPrice(self, **kw):
""" Returns the total price for this invoice """
kw.update({
'portal_type': self.getPortalObject()\
.getPortalInvoiceMovementTypeList() })
kw.setdefault('portal_type',
self.getPortalInvoiceMovementTypeList())
return Delivery.getTotalPrice(self, **kw)
security.declareProtected(
Permissions.AccessContentsInformation, 'getTotalQuantity')
def getTotalQuantity(self, **kw):
""" Returns the total quantity for this invoice """
kw.update({
'portal_type': self.getPortalObject()\
.getPortalInvoiceMovementTypeList() })
kw.setdefault('portal_type',
self.getPortalInvoiceMovementTypeList())
return Delivery.getTotalQuantity(self, **kw)
security.declareProtected(
Permissions.AccessContentsInformation, 'getTotalNetPrice')
def getTotalNetPrice(self):
""" Returns the total net price for this invoice """
raise NotImplementedError
return self.Invoice_zGetTotalNetPrice()
......@@ -719,8 +719,8 @@ class TestTaxLineCalculation(TradeConditionTestCase):
self.assertEquals(self.tax, tax_line.getResourceValue())
self.assertEquals(0.2, tax_line.getPrice())
# TODO: discuss this behaviour, and what about getTotalNetPrice ?
#self.assertEquals(120, self.order.getTotalPrice(fast=0))
self.assertEquals(100, self.order.getTotalPrice(fast=0))
self.assertEquals(120, self.order.getTotalNetPrice(fast=0))
def test_hierarchical_order_line_and_tax_line(self):
......
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