Commit 728df139 authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Jérome Perrin

testInvoice: add test to reproduce rounding issue when Accounting Transactions are created

parent 13a8ed1c
......@@ -2607,6 +2607,63 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
""")
sequence_list.play(self, quiet=quiet)
def stepCreateCurrency(self, sequence):
currency = self.portal.currency_module.newContent(
portal_type="Currency", title="Currency",
base_unit_quantity=0.01)
sequence.edit(currency=currency)
def stepCreateInvoiceWithBadPrecision(self, sequence):
portal = self.portal
vendor = sequence.get('vendor')
invoice = portal.accounting_module.newContent(
portal_type="Sale Invoice Transaction",
specialise=self.business_process,
source_section_value=vendor,
start_date=self.datetime,
price_currency_value=sequence.get('currency'),
destination_section_value=sequence.get('client1'),
source_value=vendor)
resource = self.portal.getDefaultModule(
self.resource_portal_type).newContent(
portal_type=self.resource_portal_type,
title='Resource',
sale_supply_line_source_account="account_module/sale",
product_line='apparel')
product_line = invoice.newContent(portal_type="Invoice Line",
resource_value=resource, quantity=1, price=0.014)
product_line = invoice.newContent(portal_type="Invoice Line",
resource_value=resource, quantity=1, price=0.014)
self.tic()
invoice.plan()
invoice.confirm()
self.tic()
invoice.start()
self.tic()
movement_list = invoice.getMovementList(
portal_type=invoice.getPortalAccountingMovementTypeList())
receivable_line = [m for m in movement_list \
if m.getSourceValue().getAccountType() == \
"asset/receivable"][0]
self.assertEquals(0.03, receivable_line.getSourceDebit())
vat_line = [m for m in movement_list \
if m.getSourceValue().getAccountType() == \
"liability/payable/collected_vat"][0]
self.assertEquals(0.0, vat_line.getSourceDebit())
income_line = [m for m in movement_list \
if m.getSourceValue().getAccountType() == \
"income"][0]
self.assertEquals(0.03, income_line.getSourceCredit())
def test_rounding_issue(self):
sequence_list = SequenceList()
sequence_list.addSequenceString("""
stepCreateCurrency
stepCreateEntities
stepCreateInvoiceWithBadPrecision
""")
sequence_list.play(self)
def test_02_TwoInvoicesFromTwoPackingList(self, quiet=quiet):
"""
This test was created for the following bug:
......
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