[Erp5-report] r28753 - /erp5/trunk/products/ERP5/tests/testTradeModelLine.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Sep 2 17:00:31 CEST 2009
Author: jerome
Date: Wed Sep 2 17:00:28 2009
New Revision: 28753
URL: http://svn.erp5.org?rev=28753&view=rev
Log:
Change the way total net price is calculated in this test.
Now that trade model lines are built, they are included in
invoice.getTotalPrice, so instead we manually sum all movements that are not
tax or resource.
The problem is that this test is now more complex than the code beeing tested
Modified:
erp5/trunk/products/ERP5/tests/testTradeModelLine.py
Modified: erp5/trunk/products/ERP5/tests/testTradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testTradeModelLine.py?rev=28753&r1=28752&r2=28753&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testTradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testTradeModelLine.py [utf8] Wed Sep 2 17:00:28 2009
@@ -35,10 +35,6 @@
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
-# XXX TODO:
-# * subclass TestTradeModelLine from TestInvoiceMixin and refactor methods and
-# style
-
class TestTradeModelLineMixin(TestBPMMixin):
"""Provides methods to implementations sharing similar logic to Trade Model Lines"""
# Constants and variables shared by tests
@@ -391,7 +387,14 @@
.getAccountType() in ['liability/payable/collected_vat',
'asset/receivable/refundable_vat']][0]
- rounded_total_price = round(invoice.getTotalPrice(), currency_precision)
+ # here, the net total price of the invoice is all invoices lines that does
+ # not use a tax or a discount as resource.
+ rounded_total_price = round(sum(
+ [movement.getTotalPrice() for movement in invoice.getMovementList()
+ if movement.getResource() not in (invoice_line_tax.getResource(),
+ invoice_line_discount.getResource())]),
+ currency_precision)
+
rounded_tax_price = round(invoice_line_tax.getTotalPrice(),
currency_precision)
rounded_discount_price = round(invoice_line_discount.getTotalPrice(),
More information about the Erp5-report
mailing list