Renamed "summary" to "description" in the voucher line item.
This commit is contained in:
@ -57,8 +57,8 @@ class ReportLineItem:
|
||||
"""The date."""
|
||||
self.account: Account | None = None
|
||||
"""The account."""
|
||||
self.summary: str | None = None
|
||||
"""The summary."""
|
||||
self.description: str | None = None
|
||||
"""The description."""
|
||||
self.income: Decimal | None = None
|
||||
"""The income amount."""
|
||||
self.expense: Decimal | None = None
|
||||
@ -72,7 +72,7 @@ class ReportLineItem:
|
||||
if line_item is not None:
|
||||
self.date = line_item.voucher.date
|
||||
self.account = line_item.account
|
||||
self.summary = line_item.summary
|
||||
self.description = line_item.description
|
||||
self.income = None if line_item.is_debit else line_item.amount
|
||||
self.expense = line_item.amount if line_item.is_debit else None
|
||||
self.note = line_item.voucher.note
|
||||
@ -131,7 +131,7 @@ class LineItemCollector:
|
||||
line_item.is_brought_forward = True
|
||||
line_item.date = self.__period.start
|
||||
line_item.account = Account.accumulated_change()
|
||||
line_item.summary = gettext("Brought forward")
|
||||
line_item.description = gettext("Brought forward")
|
||||
if balance > 0:
|
||||
line_item.income = balance
|
||||
elif balance < 0:
|
||||
@ -184,7 +184,7 @@ class LineItemCollector:
|
||||
return None
|
||||
line_item: ReportLineItem = ReportLineItem()
|
||||
line_item.is_total = True
|
||||
line_item.summary = gettext("Total")
|
||||
line_item.description = gettext("Total")
|
||||
line_item.income = sum([x.income for x in self.line_items
|
||||
if x.income is not None])
|
||||
line_item.expense = sum([x.expense for x in self.line_items
|
||||
@ -215,7 +215,7 @@ class CSVRow(BaseCSVRow):
|
||||
|
||||
def __init__(self, voucher_date: date | str | None,
|
||||
account: str | None,
|
||||
summary: str | None,
|
||||
description: str | None,
|
||||
income: str | Decimal | None,
|
||||
expense: str | Decimal | None,
|
||||
balance: str | Decimal | None,
|
||||
@ -224,7 +224,7 @@ class CSVRow(BaseCSVRow):
|
||||
|
||||
:param voucher_date: The voucher date.
|
||||
:param account: The account.
|
||||
:param summary: The summary.
|
||||
:param description: The description.
|
||||
:param income: The income.
|
||||
:param expense: The expense.
|
||||
:param balance: The balance.
|
||||
@ -234,8 +234,8 @@ class CSVRow(BaseCSVRow):
|
||||
"""The date."""
|
||||
self.account: str | None = account
|
||||
"""The account."""
|
||||
self.summary: str | None = summary
|
||||
"""The summary."""
|
||||
self.description: str | None = description
|
||||
"""The description."""
|
||||
self.income: str | Decimal | None = income
|
||||
"""The income."""
|
||||
self.expense: str | Decimal | None = expense
|
||||
@ -251,7 +251,7 @@ class CSVRow(BaseCSVRow):
|
||||
|
||||
:return: The values of the row.
|
||||
"""
|
||||
return [self.date, self.account, self.summary,
|
||||
return [self.date, self.account, self.description,
|
||||
self.income, self.expense, self.balance, self.note]
|
||||
|
||||
|
||||
@ -405,18 +405,18 @@ class IncomeExpenses(BaseReport):
|
||||
:return: The CSV rows.
|
||||
"""
|
||||
rows: list[CSVRow] = [CSVRow(gettext("Date"), gettext("Account"),
|
||||
gettext("Summary"), gettext("Income"),
|
||||
gettext("Description"), gettext("Income"),
|
||||
gettext("Expense"), gettext("Balance"),
|
||||
gettext("Note"))]
|
||||
if self.__brought_forward is not None:
|
||||
rows.append(CSVRow(self.__brought_forward.date,
|
||||
str(self.__brought_forward.account).title(),
|
||||
self.__brought_forward.summary,
|
||||
self.__brought_forward.description,
|
||||
self.__brought_forward.income,
|
||||
self.__brought_forward.expense,
|
||||
self.__brought_forward.balance,
|
||||
None))
|
||||
rows.extend([CSVRow(x.date, str(x.account).title(), x.summary,
|
||||
rows.extend([CSVRow(x.date, str(x.account).title(), x.description,
|
||||
x.income, x.expense, x.balance, x.note)
|
||||
for x in self.__line_items])
|
||||
if self.__total is not None:
|
||||
|
@ -53,8 +53,8 @@ class ReportLineItem:
|
||||
"""The account."""
|
||||
self.account: Account = line_item.account
|
||||
"""The account."""
|
||||
self.summary: str | None = line_item.summary
|
||||
"""The summary."""
|
||||
self.description: str | None = line_item.description
|
||||
"""The description."""
|
||||
self.debit: Decimal | None = line_item.debit
|
||||
"""The debit amount."""
|
||||
self.credit: Decimal | None = line_item.credit
|
||||
@ -69,14 +69,14 @@ class CSVRow(BaseCSVRow):
|
||||
def __init__(self, voucher_date: str | date,
|
||||
currency: str,
|
||||
account: str,
|
||||
summary: str | None,
|
||||
description: str | None,
|
||||
debit: str | Decimal | None,
|
||||
credit: str | Decimal | None,
|
||||
note: str | None):
|
||||
"""Constructs a row in the CSV.
|
||||
|
||||
:param voucher_date: The voucher date.
|
||||
:param summary: The summary.
|
||||
:param description: The description.
|
||||
:param debit: The debit amount.
|
||||
:param credit: The credit amount.
|
||||
:param note: The note.
|
||||
@ -87,8 +87,8 @@ class CSVRow(BaseCSVRow):
|
||||
"""The currency."""
|
||||
self.account: str = account
|
||||
"""The account."""
|
||||
self.summary: str | None = summary
|
||||
"""The summary."""
|
||||
self.description: str | None = description
|
||||
"""The description."""
|
||||
self.debit: str | Decimal | None = debit
|
||||
"""The debit amount."""
|
||||
self.credit: str | Decimal | None = credit
|
||||
@ -102,7 +102,7 @@ class CSVRow(BaseCSVRow):
|
||||
|
||||
:return: The values of the row.
|
||||
"""
|
||||
return [self.date, self.currency, self.account, self.summary,
|
||||
return [self.date, self.currency, self.account, self.description,
|
||||
self.debit, self.credit, self.note]
|
||||
|
||||
|
||||
@ -152,11 +152,11 @@ def get_csv_rows(line_items: list[VoucherLineItem]) -> list[CSVRow]:
|
||||
:return: The CSV rows.
|
||||
"""
|
||||
rows: list[CSVRow] = [CSVRow(gettext("Date"), gettext("Currency"),
|
||||
gettext("Account"), gettext("Summary"),
|
||||
gettext("Account"), gettext("Description"),
|
||||
gettext("Debit"), gettext("Credit"),
|
||||
gettext("Note"))]
|
||||
rows.extend([CSVRow(x.voucher.date, x.currency.code,
|
||||
str(x.account).title(), x.summary,
|
||||
str(x.account).title(), x.description,
|
||||
x.debit, x.credit, x.voucher.note)
|
||||
for x in line_items])
|
||||
return rows
|
||||
|
@ -54,8 +54,8 @@ class ReportLineItem:
|
||||
"""Whether this is the total line item."""
|
||||
self.date: date | None = None
|
||||
"""The date."""
|
||||
self.summary: str | None = None
|
||||
"""The summary."""
|
||||
self.description: str | None = None
|
||||
"""The description."""
|
||||
self.debit: Decimal | None = None
|
||||
"""The debit amount."""
|
||||
self.credit: Decimal | None = None
|
||||
@ -68,7 +68,7 @@ class ReportLineItem:
|
||||
"""The URL to the voucher line item."""
|
||||
if line_item is not None:
|
||||
self.date = line_item.voucher.date
|
||||
self.summary = line_item.summary
|
||||
self.description = line_item.description
|
||||
self.debit = line_item.amount if line_item.is_debit else None
|
||||
self.credit = None if line_item.is_debit else line_item.amount
|
||||
self.note = line_item.voucher.note
|
||||
@ -126,7 +126,7 @@ class LineItemCollector:
|
||||
line_item: ReportLineItem = ReportLineItem()
|
||||
line_item.is_brought_forward = True
|
||||
line_item.date = self.__period.start
|
||||
line_item.summary = gettext("Brought forward")
|
||||
line_item.description = gettext("Brought forward")
|
||||
if balance > 0:
|
||||
line_item.debit = balance
|
||||
elif balance < 0:
|
||||
@ -163,7 +163,7 @@ class LineItemCollector:
|
||||
return None
|
||||
line_item: ReportLineItem = ReportLineItem()
|
||||
line_item.is_total = True
|
||||
line_item.summary = gettext("Total")
|
||||
line_item.description = gettext("Total")
|
||||
line_item.debit = sum([x.debit for x in self.line_items
|
||||
if x.debit is not None])
|
||||
line_item.credit = sum([x.credit for x in self.line_items
|
||||
@ -195,7 +195,7 @@ class CSVRow(BaseCSVRow):
|
||||
"""A row in the CSV."""
|
||||
|
||||
def __init__(self, voucher_date: date | str | None,
|
||||
summary: str | None,
|
||||
description: str | None,
|
||||
debit: str | Decimal | None,
|
||||
credit: str | Decimal | None,
|
||||
balance: str | Decimal | None,
|
||||
@ -203,7 +203,7 @@ class CSVRow(BaseCSVRow):
|
||||
"""Constructs a row in the CSV.
|
||||
|
||||
:param voucher_date: The voucher date.
|
||||
:param summary: The summary.
|
||||
:param description: The description.
|
||||
:param debit: The debit amount.
|
||||
:param credit: The credit amount.
|
||||
:param balance: The balance.
|
||||
@ -211,8 +211,8 @@ class CSVRow(BaseCSVRow):
|
||||
"""
|
||||
self.date: date | str | None = voucher_date
|
||||
"""The date."""
|
||||
self.summary: str | None = summary
|
||||
"""The summary."""
|
||||
self.description: str | None = description
|
||||
"""The description."""
|
||||
self.debit: str | Decimal | None = debit
|
||||
"""The debit amount."""
|
||||
self.credit: str | Decimal | None = credit
|
||||
@ -228,7 +228,7 @@ class CSVRow(BaseCSVRow):
|
||||
|
||||
:return: The values of the row.
|
||||
"""
|
||||
return [self.date, self.summary,
|
||||
return [self.date, self.description,
|
||||
self.debit, self.credit, self.balance, self.note]
|
||||
|
||||
|
||||
@ -357,17 +357,17 @@ class Ledger(BaseReport):
|
||||
|
||||
:return: The CSV rows.
|
||||
"""
|
||||
rows: list[CSVRow] = [CSVRow(gettext("Date"), gettext("Summary"),
|
||||
rows: list[CSVRow] = [CSVRow(gettext("Date"), gettext("Description"),
|
||||
gettext("Debit"), gettext("Credit"),
|
||||
gettext("Balance"), gettext("Note"))]
|
||||
if self.__brought_forward is not None:
|
||||
rows.append(CSVRow(self.__brought_forward.date,
|
||||
self.__brought_forward.summary,
|
||||
self.__brought_forward.description,
|
||||
self.__brought_forward.debit,
|
||||
self.__brought_forward.credit,
|
||||
self.__brought_forward.balance,
|
||||
None))
|
||||
rows.extend([CSVRow(x.date, x.summary,
|
||||
rows.extend([CSVRow(x.date, x.description,
|
||||
x.debit, x.credit, x.balance, x.note)
|
||||
for x in self.__line_items])
|
||||
if self.__total is not None:
|
||||
|
@ -57,7 +57,7 @@ class LineItemCollector:
|
||||
conditions: list[sa.BinaryExpression] = []
|
||||
for k in keywords:
|
||||
sub_conditions: list[sa.BinaryExpression] \
|
||||
= [VoucherLineItem.summary.contains(k),
|
||||
= [VoucherLineItem.description.contains(k),
|
||||
VoucherLineItem.account_id.in_(
|
||||
self.__get_account_condition(k)),
|
||||
VoucherLineItem.currency_code.in_(
|
||||
|
Reference in New Issue
Block a user