Skip to content

Commit

Permalink
[FIX] account_liquidity_forecast: fix filtering of open items
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiBForgeFlow committed Apr 30, 2024
1 parent d128349 commit afc5084
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions account_liquidity_forecast/report/liquidity_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dateutil.relativedelta import relativedelta

from odoo import _, fields, models
from odoo.tools.float_utils import float_is_zero


class LiquidityForecastReport(models.AbstractModel):
Expand Down Expand Up @@ -128,15 +129,27 @@ def _complete_net_cash_flow(self, data, liquidity_forecast_lines, line, period):
def _prepare_cash_flow_lines(
self, data, liquidity_forecast_lines, period, periods, accounts, date_type
):
company_id = data.get("company_id", self.env.user.company_id.id)
company = self.env["res.company"].browse(company_id)
open_items = accounts._get_open_items_at_date(
period["date_to"], data["only_posted_moves"]
)
period_open_items = []
rounding = company.currency_id.rounding
for open_item in open_items:
if (
period["date_to"] >= open_item[date_type] >= period["date_from"]
and open_item["open_amount"]
):
(
(
period["sequence"] == 0
and period["date_to"] >= open_item[date_type]
)
or not open_item[date_type]
)
or (
period["sequence"] > 0
and period["date_to"] >= open_item[date_type] >= period["date_from"]
)
) and float_is_zero(open_item["open_amount"], precision_rounding=rounding):
period_open_items.append(open_item)
in_flows = {}
out_flows = {}
Expand Down

0 comments on commit afc5084

Please sign in to comment.