Renamed "voucher line item" to "journal entry line item".
This commit is contained in:
@ -42,7 +42,7 @@ class DescriptionEditorTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -56,7 +56,7 @@ class DescriptionEditorTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
|
||||
|
@ -27,7 +27,7 @@ from flask.testing import FlaskCliRunner
|
||||
|
||||
from test_site import db
|
||||
from testlib import create_test_app, get_client
|
||||
from testlib_offset import TestData, VoucherLineItemData, VoucherData, \
|
||||
from testlib_offset import TestData, JournalEntryLineItemData, VoucherData, \
|
||||
CurrencyData
|
||||
from testlib_voucher import Accounts, match_voucher_detail
|
||||
|
||||
@ -49,7 +49,7 @@ class OffsetTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -63,7 +63,7 @@ class OffsetTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
self.data: TestData = TestData(self.app, self.client, self.csrf_token)
|
||||
@ -84,15 +84,15 @@ class OffsetTestCase(unittest.TestCase):
|
||||
self.data.e_r_or3d.voucher.days, [CurrencyData(
|
||||
"USD",
|
||||
[],
|
||||
[VoucherLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or1d.description, "300",
|
||||
original_line_item=self.data.e_r_or1d),
|
||||
VoucherLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or1d.description, "100",
|
||||
original_line_item=self.data.e_r_or1d),
|
||||
VoucherLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or3d.description, "100",
|
||||
original_line_item=self.data.e_r_or3d)])])
|
||||
[JournalEntryLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or1d.description, "300",
|
||||
original_line_item=self.data.e_r_or1d),
|
||||
JournalEntryLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or1d.description, "100",
|
||||
original_line_item=self.data.e_r_or1d),
|
||||
JournalEntryLineItemData(Accounts.RECEIVABLE,
|
||||
self.data.e_r_or3d.description, "100",
|
||||
original_line_item=self.data.e_r_or3d)])])
|
||||
|
||||
# Non-existing original line item ID
|
||||
form = voucher_data.new_form(self.csrf_token)
|
||||
@ -399,15 +399,15 @@ class OffsetTestCase(unittest.TestCase):
|
||||
voucher_data: VoucherData = VoucherData(
|
||||
self.data.e_p_or3c.voucher.days, [CurrencyData(
|
||||
"USD",
|
||||
[VoucherLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or1c.description, "500",
|
||||
original_line_item=self.data.e_p_or1c),
|
||||
VoucherLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or1c.description, "300",
|
||||
original_line_item=self.data.e_p_or1c),
|
||||
VoucherLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or3c.description, "120",
|
||||
original_line_item=self.data.e_p_or3c)],
|
||||
[JournalEntryLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or1c.description, "500",
|
||||
original_line_item=self.data.e_p_or1c),
|
||||
JournalEntryLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or1c.description, "300",
|
||||
original_line_item=self.data.e_p_or1c),
|
||||
JournalEntryLineItemData(Accounts.PAYABLE,
|
||||
self.data.e_p_or3c.description, "120",
|
||||
original_line_item=self.data.e_p_or3c)],
|
||||
[])])
|
||||
|
||||
# Non-existing original line item ID
|
||||
|
@ -53,7 +53,7 @@ class CashReceiptVoucherTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -67,7 +67,7 @@ class CashReceiptVoucherTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
|
||||
@ -625,7 +625,7 @@ class CashDisbursementVoucherTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -639,7 +639,7 @@ class CashDisbursementVoucherTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
|
||||
@ -1204,7 +1204,7 @@ class TransferVoucherTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -1218,7 +1218,7 @@ class TransferVoucherTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
|
||||
@ -2056,7 +2056,7 @@ class VoucherReorderTestCase(unittest.TestCase):
|
||||
runner: FlaskCliRunner = self.app.test_cli_runner()
|
||||
with self.app.app_context():
|
||||
from accounting.models import BaseAccount, Voucher, \
|
||||
VoucherLineItem
|
||||
JournalEntryLineItem
|
||||
result: Result
|
||||
result = runner.invoke(args="init-db")
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
@ -2070,7 +2070,7 @@ class VoucherReorderTestCase(unittest.TestCase):
|
||||
"-u", "editor"])
|
||||
self.assertEqual(result.exit_code, 0)
|
||||
Voucher.query.delete()
|
||||
VoucherLineItem.query.delete()
|
||||
JournalEntryLineItem.query.delete()
|
||||
|
||||
self.client, self.csrf_token = get_client(self.app, "editor")
|
||||
|
||||
|
@ -29,22 +29,22 @@ from test_site import db
|
||||
from testlib_voucher import Accounts, match_voucher_detail, NEXT_URI
|
||||
|
||||
|
||||
class VoucherLineItemData:
|
||||
"""The voucher line item data."""
|
||||
class JournalEntryLineItemData:
|
||||
"""The journal entry line item data."""
|
||||
|
||||
def __init__(self, account: str, description: str, amount: str,
|
||||
original_line_item: VoucherLineItemData | None = None):
|
||||
"""Constructs the voucher line item data.
|
||||
original_line_item: JournalEntryLineItemData | None = None):
|
||||
"""Constructs the journal entry line item data.
|
||||
|
||||
:param account: The account code.
|
||||
:param description: The description.
|
||||
:param amount: The amount.
|
||||
:param original_line_item: The original voucher line item.
|
||||
:param original_line_item: The original journal entry line item.
|
||||
"""
|
||||
self.voucher: VoucherData | None = None
|
||||
self.id: int = -1
|
||||
self.no: int = -1
|
||||
self.original_line_item: VoucherLineItemData | None \
|
||||
self.original_line_item: JournalEntryLineItemData | None \
|
||||
= original_line_item
|
||||
self.account: str = account
|
||||
self.description: str = description
|
||||
@ -77,8 +77,8 @@ class VoucherLineItemData:
|
||||
class CurrencyData:
|
||||
"""The voucher currency data."""
|
||||
|
||||
def __init__(self, currency: str, debit: list[VoucherLineItemData],
|
||||
credit: list[VoucherLineItemData]):
|
||||
def __init__(self, currency: str, debit: list[JournalEntryLineItemData],
|
||||
credit: list[JournalEntryLineItemData]):
|
||||
"""Constructs the voucher currency data.
|
||||
|
||||
:param currency: The currency code.
|
||||
@ -86,8 +86,8 @@ class CurrencyData:
|
||||
:param credit: The credit line items.
|
||||
"""
|
||||
self.code: str = currency
|
||||
self.debit: list[VoucherLineItemData] = debit
|
||||
self.credit: list[VoucherLineItemData] = credit
|
||||
self.debit: list[JournalEntryLineItemData] = debit
|
||||
self.credit: list[JournalEntryLineItemData] = credit
|
||||
|
||||
def form(self, index: int, is_update: bool) -> dict[str, str]:
|
||||
"""Returns the currency as form data.
|
||||
@ -175,7 +175,7 @@ class TestData:
|
||||
self.csrf_token: str = csrf_token
|
||||
|
||||
def couple(description: str, amount: str, debit: str, credit: str) \
|
||||
-> tuple[VoucherLineItemData, VoucherLineItemData]:
|
||||
-> tuple[JournalEntryLineItemData, JournalEntryLineItemData]:
|
||||
"""Returns a couple of debit-credit line items.
|
||||
|
||||
:param description: The description.
|
||||
@ -184,8 +184,8 @@ class TestData:
|
||||
:param credit: The credit account code.
|
||||
:return: The debit line item and credit line item.
|
||||
"""
|
||||
return VoucherLineItemData(debit, description, amount),\
|
||||
VoucherLineItemData(credit, description, amount)
|
||||
return JournalEntryLineItemData(debit, description, amount),\
|
||||
JournalEntryLineItemData(credit, description, amount)
|
||||
|
||||
# Receivable original line items
|
||||
self.e_r_or1d, self.e_r_or1c = couple(
|
||||
|
Reference in New Issue
Block a user