Skip to content
Open
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
87 changes: 87 additions & 0 deletions account_liquidity_forecast_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===============================
Account Liquidity Forecast Sale
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32303c30dc7d9ce2c82299004c2f99409472e2163d9b65b72098273c9a5c047a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-reporting/tree/16.0/account_liquidity_forecast_sale
:alt: OCA/account-financial-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-account_liquidity_forecast_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of account_liquidity_forecast by enabling the option
of adding the Requests for Quotation on the report. The report uses Date Order (date_order)
field on the Request for Quotation.

To launch the report wizard, navigate to Accounting/Invoicing > Reporting > Liquidity Forecast.
A configuration wizard will open, allowing you to define the parameters for the report.

This module adds a new option:

- Select "Include draft SO": If checked, the report will include draft Sale Orders.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_liquidity_forecast_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* `ForgeFlow <https://www.forgeflow.com>`__:

* Mateu Griful

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/16.0/account_liquidity_forecast_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_liquidity_forecast_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import report
from . import wizards
17 changes: 17 additions & 0 deletions account_liquidity_forecast_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
{
"name": "Account Liquidity Forecast Sale",
"version": "16.0.1.0.0",
"category": "Reporting",
"summary": "Account Liquidity Forecast Sale",
"author": "ForgeFlow," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-reporting",
"depends": ["account_liquidity_forecast", "sale"],
"data": [
"wizards/account_liquidity_forecast_wizard_views.xml",
],
"installable": True,
"application": True,
"auto_install": False,
"license": "AGPL-3",
}
3 changes: 3 additions & 0 deletions account_liquidity_forecast_sale/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `ForgeFlow <https://www.forgeflow.com>`__:

* Mateu Griful
10 changes: 10 additions & 0 deletions account_liquidity_forecast_sale/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This module extends the functionality of account_liquidity_forecast by enabling the option
of adding the Requests for Quotation on the report. The report uses Date Order (date_order)
field on the Request for Quotation.

To launch the report wizard, navigate to Accounting/Invoicing > Reporting > Liquidity Forecast.
A configuration wizard will open, allowing you to define the parameters for the report.

This module adds a new option:

- Select "Include draft SO": If checked, the report will include draft Sale Orders.
1 change: 1 addition & 0 deletions account_liquidity_forecast_sale/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import liquidity_forecast
70 changes: 70 additions & 0 deletions account_liquidity_forecast_sale/report/liquidity_forecast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import _, models


class LiquidityForecastReport(models.AbstractModel):
_inherit = "report.account_liquidity_forecast.liquidity_forecast"

def _prepare_liquidity_forecast_lines_period(
self, data, liquidity_forecast_lines, period, periods
):
res = super()._prepare_liquidity_forecast_lines_period(
data, liquidity_forecast_lines, period, periods
)
include_so_draft = data.get("include_so_draft", False)
if include_so_draft:
self._prepare_cash_flow_lines_sale_draft(
data, liquidity_forecast_lines, period, periods
)
return res

def _prepare_cash_flow_lines_sale_draft(
self, data, liquidity_forecast_lines, period, periods
):
domain = self.get_so_domain(period)

draft_sale_orders = self.env["sale.order"].search(domain)
if not draft_sale_orders:
return

sale_lines = draft_sale_orders.mapped("order_line")
if not sale_lines:
return

code = "cash_flow_line_out_sale_draft"
existing_lines = [
line for line in liquidity_forecast_lines if line["code"] == code
]

if existing_lines:
flow_line = existing_lines[0]
else:
flow_line = {
"code": code,
"type": "amount",
"level": "detail",
"model": "sale.order.line",
"title": _("Draft Sale Orders"),
"sequence": 3500,
"periods": {
p["sequence"]: {"amount": 0.0, "domain": []} for p in periods
},
}
liquidity_forecast_lines.append(flow_line)

total = sum(sale_line.price_subtotal for sale_line in sale_lines)
flow_line["periods"][period["sequence"]]["amount"] += total
flow_line["periods"][period["sequence"]]["domain"] = [
("id", "in", sale_lines.ids)
]

def get_so_domain(self, period):
domain = [
("state", "in", ["draft", "sent"]),
("date_order", "<=", period["date_to"]),
]
if period["sequence"] > 0:
domain.append(("date_order", ">=", period["date_from"]))
return domain
Loading
Loading