diff --git a/brewman/brewman/routers/reports/cash_flow.py b/brewman/brewman/routers/reports/cash_flow.py index 58a1c07f..b5e9eb68 100644 --- a/brewman/brewman/routers/reports/cash_flow.py +++ b/brewman/brewman/routers/reports/cash_flow.py @@ -112,7 +112,7 @@ def build_report( schemas.CashFlowItem( name=account_type.name, url=["/", "cash-flow", str(account_type.id)], - amount=amount * -1, + amount=round(amount * -1, 2), ) ) @@ -144,14 +144,14 @@ def build_report( schemas.CashFlowItem( name="Net increase in cash and cash equivalents", url=[], - amount=total_amount, + amount=round(total_amount, 2), ), schemas.CashFlowItem( name="Cash and cash equivalents at beginning of period", url=[], - amount=opening, + amount=round(opening, 2), ), - schemas.CashFlowItem(name="Cash and cash equivalents at end of period", url=[], amount=closing), + schemas.CashFlowItem(name="Cash and cash equivalents at end of period", url=[], amount=round(closing, 2)), ], ) @@ -188,8 +188,8 @@ def build_report_id( schemas.CashFlowItem( name=account.name, url=["/", "ledger", str(account.id)], - amount=amount * -1, + amount=round(amount * -1, 2), ) ) - return cf, [schemas.CashFlowItem(name="total", url=[], amount=total_amount)] + return cf, [schemas.CashFlowItem(name="total", url=[], amount=round(total_amount, 2))] diff --git a/brewman/brewman/schemas/cash_flow.py b/brewman/brewman/schemas/cash_flow.py index cedf2064..05e0ff81 100644 --- a/brewman/brewman/schemas/cash_flow.py +++ b/brewman/brewman/schemas/cash_flow.py @@ -2,7 +2,7 @@ from datetime import date, datetime from decimal import Decimal from typing import List, Optional, Union -from pydantic import Field, validator +from pydantic import validator from pydantic.main import BaseModel from . import to_camel @@ -11,7 +11,7 @@ from . import to_camel class CashFlowItem(BaseModel): name: str url: Optional[List[str]] - amount: Decimal = Field(multiple_of=0.01) + amount: Decimal class Config: anystr_strip_whitespace = True