Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reported_in_mt940 to AccountingLog #33

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def account_statement_generator(account_statement_id: int):
account_logs = (
session.execute(
select(AccountingLog).where(
AccountingLog.account_number == account_statement.account_number
AccountingLog.account_number == account_statement.account_number,
AccountingLog.reported_in_mt940.is_(False),
)
)
.scalars()
Expand Down Expand Up @@ -115,6 +116,9 @@ def account_statement_generator(account_statement_id: int):
f"\n{account_log.narrative_5}\n{account_log.narrative_6}",
)
)
# Update the log to indicate that it has been reported in the MT940 statement
account_log.reported_in_mt940 = True


statement = mt940_writer.create_statement(
account_statement_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum

from openg2p_fastapi_common.models import BaseORMModelWithTimes
from sqlalchemy import DateTime, Float, String, Text
from sqlalchemy import DateTime, Float, String, Text, Boolean
from sqlalchemy import Enum as SqlEnum
from sqlalchemy.orm import Mapped, mapped_column

Expand Down Expand Up @@ -43,3 +43,4 @@ class AccountingLog(BaseORMModelWithTimes):
narrative_6: Mapped[str] = mapped_column(
String, nullable=True
) # beneficiary phone number
reported_in_mt940: Mapped[bool] = mapped_column(Boolean, default=False)
Loading