2023-03-17 22:32:01 +08:00
|
|
|
# The Mia! Accounting Flask Project.
|
|
|
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/27
|
|
|
|
|
|
|
|
# Copyright (c) 2023 imacat.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
"""The common test libraries for the offset test cases.
|
|
|
|
|
|
|
|
"""
|
|
|
|
from __future__ import annotations
|
2023-03-18 03:21:47 +08:00
|
|
|
|
2023-03-17 22:32:01 +08:00
|
|
|
from datetime import date, timedelta
|
2023-03-18 03:21:47 +08:00
|
|
|
from decimal import Decimal
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
import httpx
|
|
|
|
from flask import Flask
|
|
|
|
|
|
|
|
from test_site import db
|
2023-03-23 17:26:27 +08:00
|
|
|
from testlib import NEXT_URI, Accounts
|
|
|
|
from testlib_journal_entry import match_journal_entry_detail
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
|
2023-03-20 20:52:35 +08:00
|
|
|
class JournalEntryLineItemData:
|
|
|
|
"""The journal entry line item data."""
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 16:01:25 +08:00
|
|
|
def __init__(self, account: str, description: str, amount: str,
|
2023-03-20 20:52:35 +08:00
|
|
|
original_line_item: JournalEntryLineItemData | None = None):
|
|
|
|
"""Constructs the journal entry line item data.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param account: The account code.
|
2023-03-20 16:01:25 +08:00
|
|
|
:param description: The description.
|
2023-03-17 22:32:01 +08:00
|
|
|
:param amount: The amount.
|
2023-03-20 20:52:35 +08:00
|
|
|
:param original_line_item: The original journal entry line item.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
2023-03-20 22:08:58 +08:00
|
|
|
self.journal_entry: JournalEntryData | None = None
|
2023-03-17 22:32:01 +08:00
|
|
|
self.id: int = -1
|
|
|
|
self.no: int = -1
|
2023-03-20 20:52:35 +08:00
|
|
|
self.original_line_item: JournalEntryLineItemData | None \
|
2023-03-19 21:00:11 +08:00
|
|
|
= original_line_item
|
2023-03-17 22:32:01 +08:00
|
|
|
self.account: str = account
|
2023-03-20 16:01:25 +08:00
|
|
|
self.description: str = description
|
2023-03-18 03:21:47 +08:00
|
|
|
self.amount: Decimal = Decimal(amount)
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 20:35:10 +08:00
|
|
|
def form(self, prefix: str, debit_credit: str, index: int,
|
|
|
|
is_update: bool) -> dict[str, str]:
|
2023-03-19 21:00:11 +08:00
|
|
|
"""Returns the line item as form data.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param prefix: The prefix of the form fields.
|
2023-03-20 20:35:10 +08:00
|
|
|
:param debit_credit: Either "debit" or "credit".
|
2023-03-19 21:00:11 +08:00
|
|
|
:param index: The line item index.
|
2023-03-17 22:32:01 +08:00
|
|
|
:param is_update: True for an update operation, or False otherwise
|
|
|
|
:return: The form data.
|
|
|
|
"""
|
2023-03-20 20:35:10 +08:00
|
|
|
prefix = f"{prefix}-{debit_credit}-{index}"
|
2023-03-17 22:32:01 +08:00
|
|
|
form: dict[str, str] = {f"{prefix}-account_code": self.account,
|
2023-03-20 16:01:25 +08:00
|
|
|
f"{prefix}-description": self.description,
|
2023-03-18 03:21:47 +08:00
|
|
|
f"{prefix}-amount": str(self.amount)}
|
2023-03-17 22:32:01 +08:00
|
|
|
if is_update and self.id != -1:
|
2023-03-20 23:06:57 +08:00
|
|
|
form[f"{prefix}-id"] = str(self.id)
|
2023-03-17 22:32:01 +08:00
|
|
|
form[f"{prefix}-no"] = str(index) if self.no == -1 else str(self.no)
|
2023-03-19 21:00:11 +08:00
|
|
|
if self.original_line_item is not None:
|
|
|
|
assert self.original_line_item.id != -1
|
|
|
|
form[f"{prefix}-original_line_item_id"] \
|
|
|
|
= str(self.original_line_item.id)
|
2023-03-17 22:32:01 +08:00
|
|
|
return form
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyData:
|
2023-03-20 22:08:58 +08:00
|
|
|
"""The journal entry currency data."""
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 20:52:35 +08:00
|
|
|
def __init__(self, currency: str, debit: list[JournalEntryLineItemData],
|
|
|
|
credit: list[JournalEntryLineItemData]):
|
2023-03-20 22:08:58 +08:00
|
|
|
"""Constructs the journal entry currency data.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param currency: The currency code.
|
2023-03-19 21:00:11 +08:00
|
|
|
:param debit: The debit line items.
|
|
|
|
:param credit: The credit line items.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
|
|
|
self.code: str = currency
|
2023-03-20 20:52:35 +08:00
|
|
|
self.debit: list[JournalEntryLineItemData] = debit
|
|
|
|
self.credit: list[JournalEntryLineItemData] = credit
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
def form(self, index: int, is_update: bool) -> dict[str, str]:
|
|
|
|
"""Returns the currency as form data.
|
|
|
|
|
|
|
|
:param index: The currency index.
|
|
|
|
:param is_update: True for an update operation, or False otherwise
|
|
|
|
:return: The form data.
|
|
|
|
"""
|
|
|
|
prefix: str = f"currency-{index}"
|
|
|
|
form: dict[str, str] = {f"{prefix}-code": self.code}
|
|
|
|
for i in range(len(self.debit)):
|
|
|
|
form.update(self.debit[i].form(prefix, "debit", i + 1, is_update))
|
|
|
|
for i in range(len(self.credit)):
|
|
|
|
form.update(self.credit[i].form(prefix, "credit", i + 1,
|
|
|
|
is_update))
|
|
|
|
return form
|
|
|
|
|
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
class JournalEntryData:
|
|
|
|
"""The journal entry data."""
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
def __init__(self, days: int, currencies: list[CurrencyData]):
|
2023-03-20 22:08:58 +08:00
|
|
|
"""Constructs a journal entry.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param days: The number of days before today.
|
2023-03-20 22:08:58 +08:00
|
|
|
:param currencies: The journal entry currency data.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
|
|
|
self.id: int = -1
|
|
|
|
self.days: int = days
|
|
|
|
self.currencies: list[CurrencyData] = currencies
|
|
|
|
self.note: str | None = None
|
|
|
|
for currency in self.currencies:
|
2023-03-19 21:00:11 +08:00
|
|
|
for line_item in currency.debit:
|
2023-03-20 22:08:58 +08:00
|
|
|
line_item.journal_entry = self
|
2023-03-19 21:00:11 +08:00
|
|
|
for line_item in currency.credit:
|
2023-03-20 22:08:58 +08:00
|
|
|
line_item.journal_entry = self
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
def new_form(self, csrf_token: str) -> dict[str, str]:
|
2023-03-20 22:08:58 +08:00
|
|
|
"""Returns the journal entry as a creation form.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param csrf_token: The CSRF token.
|
2023-03-20 22:08:58 +08:00
|
|
|
:return: The journal entry as a creation form.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
|
|
|
return self.__form(csrf_token, is_update=False)
|
|
|
|
|
|
|
|
def update_form(self, csrf_token: str) -> dict[str, str]:
|
2023-03-20 22:08:58 +08:00
|
|
|
"""Returns the journal entry as an update form.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param csrf_token: The CSRF token.
|
2023-03-20 22:08:58 +08:00
|
|
|
:return: The journal entry as an update form.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
|
|
|
return self.__form(csrf_token, is_update=True)
|
|
|
|
|
|
|
|
def __form(self, csrf_token: str, is_update: bool = False) \
|
|
|
|
-> dict[str, str]:
|
2023-03-20 22:08:58 +08:00
|
|
|
"""Returns the journal entry as a form.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
:param csrf_token: The CSRF token.
|
|
|
|
:param is_update: True for an update operation, or False otherwise
|
2023-03-20 22:08:58 +08:00
|
|
|
:return: The journal entry as a form.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
2023-03-20 22:08:58 +08:00
|
|
|
journal_entry_date: date = date.today() - timedelta(days=self.days)
|
2023-03-17 22:32:01 +08:00
|
|
|
form: dict[str, str] = {"csrf_token": csrf_token,
|
|
|
|
"next": NEXT_URI,
|
2023-03-20 22:08:58 +08:00
|
|
|
"date": journal_entry_date.isoformat()}
|
2023-03-17 22:32:01 +08:00
|
|
|
for i in range(len(self.currencies)):
|
|
|
|
form.update(self.currencies[i].form(i + 1, is_update))
|
|
|
|
if self.note is not None:
|
|
|
|
form["note"] = self.note
|
|
|
|
return form
|
|
|
|
|
|
|
|
|
|
|
|
class TestData:
|
|
|
|
"""The test data."""
|
|
|
|
|
|
|
|
def __init__(self, app: Flask, client: httpx.Client, csrf_token: str):
|
|
|
|
"""Constructs the test data.
|
|
|
|
|
|
|
|
:param app: The Flask application.
|
|
|
|
:param client: The client.
|
|
|
|
:param csrf_token: The CSRF token.
|
|
|
|
"""
|
|
|
|
self.app: Flask = app
|
|
|
|
self.client: httpx.Client = client
|
|
|
|
self.csrf_token: str = csrf_token
|
|
|
|
|
2023-03-20 16:01:25 +08:00
|
|
|
def couple(description: str, amount: str, debit: str, credit: str) \
|
2023-03-20 20:52:35 +08:00
|
|
|
-> tuple[JournalEntryLineItemData, JournalEntryLineItemData]:
|
2023-03-19 21:00:11 +08:00
|
|
|
"""Returns a couple of debit-credit line items.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 16:01:25 +08:00
|
|
|
:param description: The description.
|
2023-03-17 22:32:01 +08:00
|
|
|
:param amount: The amount.
|
|
|
|
:param debit: The debit account code.
|
|
|
|
:param credit: The credit account code.
|
2023-03-19 21:00:11 +08:00
|
|
|
:return: The debit line item and credit line item.
|
2023-03-17 22:32:01 +08:00
|
|
|
"""
|
2023-03-20 20:52:35 +08:00
|
|
|
return JournalEntryLineItemData(debit, description, amount),\
|
|
|
|
JournalEntryLineItemData(credit, description, amount)
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-19 21:00:11 +08:00
|
|
|
# Receivable original line items
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_or1d, self.e_r_or1c = couple(
|
|
|
|
"Accountant", "1200", Accounts.RECEIVABLE, Accounts.SERVICE)
|
|
|
|
self.e_r_or2d, self.e_r_or2c = couple(
|
|
|
|
"Toy", "600", Accounts.RECEIVABLE, Accounts.SALES)
|
|
|
|
self.e_r_or3d, self.e_r_or3c = couple(
|
|
|
|
"Noodles", "100", Accounts.RECEIVABLE, Accounts.SALES)
|
|
|
|
self.e_r_or4d, self.e_r_or4c = couple(
|
|
|
|
"Interest", "3.4", Accounts.RECEIVABLE, Accounts.INTEREST)
|
|
|
|
|
2023-03-19 21:00:11 +08:00
|
|
|
# Payable original line items
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_or1d, self.e_p_or1c = couple(
|
2023-03-18 03:41:51 +08:00
|
|
|
"Airplane", "2000", Accounts.TRAVEL, Accounts.PAYABLE)
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_or2d, self.e_p_or2c = couple(
|
|
|
|
"Phone", "900", Accounts.OFFICE, Accounts.PAYABLE)
|
|
|
|
self.e_p_or3d, self.e_p_or3c = couple(
|
|
|
|
"Steak", "120", Accounts.MEAL, Accounts.PAYABLE)
|
|
|
|
self.e_p_or4d, self.e_p_or4c = couple(
|
|
|
|
"Envelop", "0.9", Accounts.OFFICE, Accounts.PAYABLE)
|
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
# Original journal entries
|
|
|
|
self.v_r_or1: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
50, [CurrencyData("USD", [self.e_r_or1d, self.e_r_or4d],
|
|
|
|
[self.e_r_or1c, self.e_r_or4c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_r_or2: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
30, [CurrencyData("USD", [self.e_r_or2d, self.e_r_or3d],
|
|
|
|
[self.e_r_or2c, self.e_r_or3c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_p_or1: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
40, [CurrencyData("USD", [self.e_p_or1d, self.e_p_or4d],
|
|
|
|
[self.e_p_or1c, self.e_p_or4c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_p_or2: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
20, [CurrencyData("USD", [self.e_p_or2d, self.e_p_or3d],
|
|
|
|
[self.e_p_or2c, self.e_p_or3c])])
|
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
self.__add_journal_entry(self.v_r_or1)
|
|
|
|
self.__add_journal_entry(self.v_r_or2)
|
|
|
|
self.__add_journal_entry(self.v_p_or1)
|
|
|
|
self.__add_journal_entry(self.v_p_or2)
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-19 21:00:11 +08:00
|
|
|
# Receivable offset items
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_of1d, self.e_r_of1c = couple(
|
|
|
|
"Accountant", "500", Accounts.CASH, Accounts.RECEIVABLE)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_r_of1c.original_line_item = self.e_r_or1d
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_of2d, self.e_r_of2c = couple(
|
|
|
|
"Accountant", "200", Accounts.CASH, Accounts.RECEIVABLE)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_r_of2c.original_line_item = self.e_r_or1d
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_of3d, self.e_r_of3c = couple(
|
|
|
|
"Accountant", "100", Accounts.CASH, Accounts.RECEIVABLE)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_r_of3c.original_line_item = self.e_r_or1d
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_of4d, self.e_r_of4c = couple(
|
|
|
|
"Toy", "240", Accounts.CASH, Accounts.RECEIVABLE)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_r_of4c.original_line_item = self.e_r_or2d
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_r_of5d, self.e_r_of5c = couple(
|
|
|
|
"Interest", "3.4", Accounts.CASH, Accounts.RECEIVABLE)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_r_of5c.original_line_item = self.e_r_or4d
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-19 21:00:11 +08:00
|
|
|
# Payable offset items
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_of1d, self.e_p_of1c = couple(
|
2023-03-18 03:41:51 +08:00
|
|
|
"Airplane", "800", Accounts.PAYABLE, Accounts.CASH)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_p_of1d.original_line_item = self.e_p_or1c
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_of2d, self.e_p_of2c = couple(
|
2023-03-18 03:41:51 +08:00
|
|
|
"Airplane", "300", Accounts.PAYABLE, Accounts.CASH)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_p_of2d.original_line_item = self.e_p_or1c
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_of3d, self.e_p_of3c = couple(
|
2023-03-18 03:41:51 +08:00
|
|
|
"Airplane", "100", Accounts.PAYABLE, Accounts.CASH)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_p_of3d.original_line_item = self.e_p_or1c
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_of4d, self.e_p_of4c = couple(
|
|
|
|
"Phone", "400", Accounts.PAYABLE, Accounts.CASH)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_p_of4d.original_line_item = self.e_p_or2c
|
2023-03-17 22:32:01 +08:00
|
|
|
self.e_p_of5d, self.e_p_of5c = couple(
|
|
|
|
"Envelop", "0.9", Accounts.PAYABLE, Accounts.CASH)
|
2023-03-19 21:00:11 +08:00
|
|
|
self.e_p_of5d.original_line_item = self.e_p_or4c
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
# Offset journal entries
|
|
|
|
self.v_r_of1: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
25, [CurrencyData("USD", [self.e_r_of1d], [self.e_r_of1c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_r_of2: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
20, [CurrencyData("USD",
|
|
|
|
[self.e_r_of2d, self.e_r_of3d, self.e_r_of4d],
|
|
|
|
[self.e_r_of2c, self.e_r_of3c, self.e_r_of4c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_r_of3: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
15, [CurrencyData("USD", [self.e_r_of5d], [self.e_r_of5c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_p_of1: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
15, [CurrencyData("USD", [self.e_p_of1d], [self.e_p_of1c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_p_of2: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
10, [CurrencyData("USD",
|
|
|
|
[self.e_p_of2d, self.e_p_of3d, self.e_p_of4d],
|
|
|
|
[self.e_p_of2c, self.e_p_of3c, self.e_p_of4c])])
|
2023-03-20 22:08:58 +08:00
|
|
|
self.v_p_of3: JournalEntryData = JournalEntryData(
|
2023-03-17 22:32:01 +08:00
|
|
|
5, [CurrencyData("USD", [self.e_p_of5d], [self.e_p_of5c])])
|
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
self.__add_journal_entry(self.v_r_of1)
|
|
|
|
self.__add_journal_entry(self.v_r_of2)
|
|
|
|
self.__add_journal_entry(self.v_r_of3)
|
|
|
|
self.__add_journal_entry(self.v_p_of1)
|
|
|
|
self.__add_journal_entry(self.v_p_of2)
|
|
|
|
self.__add_journal_entry(self.v_p_of3)
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
def __add_journal_entry(self, journal_entry_data: JournalEntryData) \
|
|
|
|
-> None:
|
|
|
|
"""Adds a journal entry.
|
2023-03-17 22:32:01 +08:00
|
|
|
|
2023-03-20 22:08:58 +08:00
|
|
|
:param journal_entry_data: The journal entry data.
|
2023-03-17 22:32:01 +08:00
|
|
|
:return: None.
|
|
|
|
"""
|
2023-03-20 22:08:58 +08:00
|
|
|
from accounting.models import JournalEntry
|
|
|
|
store_uri: str = "/accounting/journal-entries/store/transfer"
|
2023-03-17 22:32:01 +08:00
|
|
|
|
|
|
|
response: httpx.Response = self.client.post(
|
2023-03-20 22:08:58 +08:00
|
|
|
store_uri, data=journal_entry_data.new_form(self.csrf_token))
|
2023-03-17 22:32:01 +08:00
|
|
|
assert response.status_code == 302
|
2023-03-20 22:08:58 +08:00
|
|
|
journal_entry_id: int \
|
|
|
|
= match_journal_entry_detail(response.headers["Location"])
|
|
|
|
journal_entry_data.id = journal_entry_id
|
2023-03-17 22:32:01 +08:00
|
|
|
with self.app.app_context():
|
2023-03-20 22:08:58 +08:00
|
|
|
journal_entry: JournalEntry | None \
|
|
|
|
= db.session.get(JournalEntry, journal_entry_id)
|
|
|
|
assert journal_entry is not None
|
|
|
|
for i in range(len(journal_entry.currencies)):
|
|
|
|
for j in range(len(journal_entry.currencies[i].debit)):
|
|
|
|
journal_entry_data.currencies[i].debit[j].id \
|
|
|
|
= journal_entry.currencies[i].debit[j].id
|
|
|
|
for j in range(len(journal_entry.currencies[i].credit)):
|
|
|
|
journal_entry_data.currencies[i].credit[j].id \
|
|
|
|
= journal_entry.currencies[i].credit[j].id
|