Commit 6fc0872d authored by Jérome Perrin's avatar Jérome Perrin

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



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28753 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ab436d40
...@@ -35,10 +35,6 @@ from Products.ERP5Type.tests.Sequence import SequenceList ...@@ -35,10 +35,6 @@ from Products.ERP5Type.tests.Sequence import SequenceList
from DateTime import DateTime from DateTime import DateTime
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
# XXX TODO:
# * subclass TestTradeModelLine from TestInvoiceMixin and refactor methods and
# style
class TestTradeModelLineMixin(TestBPMMixin): class TestTradeModelLineMixin(TestBPMMixin):
"""Provides methods to implementations sharing similar logic to Trade Model Lines""" """Provides methods to implementations sharing similar logic to Trade Model Lines"""
# Constants and variables shared by tests # Constants and variables shared by tests
...@@ -391,7 +387,14 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -391,7 +387,14 @@ class TestTradeModelLine(TestTradeModelLineMixin):
.getAccountType() in ['liability/payable/collected_vat', .getAccountType() in ['liability/payable/collected_vat',
'asset/receivable/refundable_vat']][0] '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(), rounded_tax_price = round(invoice_line_tax.getTotalPrice(),
currency_precision) currency_precision)
rounded_discount_price = round(invoice_line_discount.getTotalPrice(), rounded_discount_price = round(invoice_line_discount.getTotalPrice(),
......
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