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

[16.0][WIP][ADD] account_liquidity_forecast #1084

Open
wants to merge 7 commits into
base: 16.0
Choose a base branch
from
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
78 changes: 78 additions & 0 deletions account_liquidity_forecast/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
==========================
Account Liquidity Forecast
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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
: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
: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|


**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%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>`__:

* Jordi Ballester
* Jasmin Solanki

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>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_liquidity_forecast/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from . import report
from . import wizards
31 changes: 31 additions & 0 deletions account_liquidity_forecast/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
{
"name": "Account Liquidity Forecast",
"version": "16.0.1.0.0",
"category": "Reporting",
"summary": "Account Liquidity Forecast",
"author": "ForgeFlow," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-reporting",
"depends": ["account", "report_xlsx", "report_xlsx_helper"],
"data": [
"security/ir.model.access.csv",
"security/security.xml",
"wizards/account_liquidity_forecast_wizard_views.xml",
"views/report_liquidity_forecast_views.xml",
"views/account_liquidity_forecast_planning_item_views.xml",
"views/account_liquidity_forecast_planning_group_views.xml",
"menuitems.xml",
"reports.xml",
"report/templates/layouts.xml",
"report/templates/liquidity_forecast.xml",
],
"assets": {
"web.assets_backend": [
"account_liquidity_forecast/static/src/js/*",
],
},
"installable": True,
"application": True,
"auto_install": False,
"license": "AGPL-3",
}
26 changes: 26 additions & 0 deletions account_liquidity_forecast/menuitems.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem
parent="account.menu_finance_reports"
id="menu_liquidity_forecast"
action="action_liquidity_forecast_wizard"
name="Liquidity Forecast"
groups="account.group_account_user"
/>

<menuitem
name="Liquidity Forecast Planning Groups"
id="account_liquidity_forecast_planning_group_menu"
parent="account.account_account_menu"
action="account_liquidity_forecast_planning_group_action"
groups="account.group_account_manager"
/>
<menuitem
name="Liquidity Forecast Planning Items"
id="account_liquidity_forecast_planning_item_menu"
parent="account.menu_finance_entries_management"
action="account_liquidity_forecast_planning_item_action"
groups="account.group_account_user"
/>

</odoo>
4 changes: 4 additions & 0 deletions account_liquidity_forecast/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import ir_actions_report
from . import account_account
from . import account_liquidity_forecast_planning_group
from . import account_liquidity_forecast_planning_item
27 changes: 27 additions & 0 deletions account_liquidity_forecast/models/account_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 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 AccountAccount(models.Model):
_inherit = "account.account"

def _get_open_items_at_date(self, date, only_posted_moves):
if not date or not self:
return []
move_states = ["posted"]

Check warning on line 13 in account_liquidity_forecast/models/account_account.py

View check run for this annotation

Codecov / codecov/patch

account_liquidity_forecast/models/account_account.py#L12-L13

Added lines #L12 - L13 were not covered by tests
if not only_posted_moves:
move_states.append("draft")
amls = self.env["account.move.line"].search(

Check warning on line 16 in account_liquidity_forecast/models/account_account.py

View check run for this annotation

Codecov / codecov/patch

account_liquidity_forecast/models/account_account.py#L15-L16

Added lines #L15 - L16 were not covered by tests
[
("reconciled", "=", False),
("account_id", "in", self.ids),
"|",
("date_maturity", "<=", date),
"&",
("date_maturity", "=", False),
("date", "<=", date),
]
)
return amls

Check warning on line 27 in account_liquidity_forecast/models/account_account.py

View check run for this annotation

Codecov / codecov/patch

account_liquidity_forecast/models/account_account.py#L27

Added line #L27 was not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class AccountLiquidityForecastPlanningGroup(models.Model):
_name = "account.liquidity.forecast.planning.group"
_description = "Liquidity Forecast Planning Group"

name = fields.Char(required=True, translate=True)
company_id = fields.Many2one(
"res.company",
string="Company",
required=True,
default=lambda self: self.env.company,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class AccountLiquidityForecastPlanningItem(models.Model):
_name = "account.liquidity.forecast.planning.item"
_description = "Liquidity Forecast Planning Item"

name = fields.Char(required=True)
group_id = fields.Many2one(
string="Planning Group",
comodel_name="account.liquidity.forecast.planning.group",
)
company_id = fields.Many2one(
"res.company",
string="Company",
required=True,
default=lambda self: self.env.company,
index=True,
)
company_currency_id = fields.Many2one(
string="Company Currency",
related="company_id.currency_id",
readonly=True,
store=True,
precompute=True,
)
amount = fields.Monetary(currency_field="company_currency_id")
direction = fields.Selection(
selection=[("in", "Incoming"), ("out", "Outgoing")],
default="in",
index=True,
)
date = fields.Date(index=True)
expiry_date = fields.Date(index=True)
27 changes: 27 additions & 0 deletions account_liquidity_forecast/models/ir_actions_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class IrActionsReport(models.Model):
_inherit = "ir.actions.report"

@api.model
def _prepare_liquidity_forecast_report_context(self, data):
lang = data and data.get("liquidity_forecast_report_lang") or ""
return dict(self.env.context or {}, lang=lang) if lang else False

@api.model
def _render_qweb_html(self, report_ref, docids, data=None):
context = self._prepare_liquidity_forecast_report_context(data)
obj = self.with_context(**context) if context else self
return super(IrActionsReport, obj)._render_qweb_html(
report_ref, docids, data=data
)

@api.model
def _render_xlsx(self, report_ref, docids, data=None):
context = self._prepare_liquidity_forecast_report_context(data)
obj = self.with_context(**context) if context else self
return super(IrActionsReport, obj)._render_xlsx(report_ref, docids, data=data)
4 changes: 4 additions & 0 deletions account_liquidity_forecast/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `ForgeFlow <https://www.forgeflow.com>`__:

* Jordi Ballester
* Jasmin Solanki
Empty file.
2 changes: 2 additions & 0 deletions account_liquidity_forecast/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import liquidity_forecast
from . import liquidity_forecast_xlsx
Loading
Loading