[IMP] mis_builder_cash_flow: Consider states according selection
"Target Moves" option in MIS report instance was previously ignored. Now it's taken into account, but still excluding cancelled entries.pull/865/head
parent
49281e7d22
commit
a8dfb11a5f
|
@ -43,6 +43,10 @@ To use this module, you need to:
|
|||
|
||||
#. Go to Accounting > Reports > MIS Reporting > MIS Reports and choose "Cash Flow" report
|
||||
#. You can add forecast lines on Accounting > Reports > MIS Reporting > Cash Flow Forecast Line
|
||||
#. If you select on "Target Moves" the value "All Posted Entries", you will get only
|
||||
lines for already posted invoices/entries + the forecast lines.
|
||||
#. Selecting "All Entries", draft invoices/entries are also included.
|
||||
#. In any case, cancelled invoices/entries are not included.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
@ -75,6 +79,9 @@ Contributors
|
|||
* Juan José Scarafía <jjs@adhoc.com.ar>
|
||||
* Gonzalo Ruzafa <gr@adhoc.com.ar>
|
||||
* Alberto Martín <alberto.martin@guadaltech.es>
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Pedro M. Baeza
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2019 ADHOC SA
|
||||
# Copyright 2021 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2019 ADHOC SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import mis_cash_flow_forecast_line
|
||||
from . import account_account
|
||||
from . import mis_cash_flow_forecast_line
|
||||
from . import mis_report_instance
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright 2021 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import models
|
||||
|
||||
|
||||
class MisReportInstancePeriod(models.Model):
|
||||
_inherit = "mis.report.instance.period"
|
||||
|
||||
def _get_additional_move_line_filter(self):
|
||||
"""Add the posted condition ."""
|
||||
domain = super()._get_additional_move_line_filter()
|
||||
if (
|
||||
self._get_aml_model_name() == "mis.cash_flow"
|
||||
and self.report_instance_id.target_move == "posted"
|
||||
):
|
||||
domain += [("state", "=", "posted")]
|
||||
return domain
|
|
@ -1,3 +1,6 @@
|
|||
* Juan José Scarafía <jjs@adhoc.com.ar>
|
||||
* Gonzalo Ruzafa <gr@adhoc.com.ar>
|
||||
* Alberto Martín <alberto.martin@guadaltech.es>
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Pedro M. Baeza
|
||||
|
|
|
@ -2,3 +2,7 @@ To use this module, you need to:
|
|||
|
||||
#. Go to Accounting > Reports > MIS Reporting > MIS Reports and choose "Cash Flow" report
|
||||
#. You can add forecast lines on Accounting > Reports > MIS Reporting > Cash Flow Forecast Line
|
||||
#. If you select on "Target Moves" the value "All Posted Entries", you will get only
|
||||
lines for already posted invoices/entries + the forecast lines.
|
||||
#. Selecting "All Entries", draft invoices/entries are also included.
|
||||
#. In any case, cancelled invoices/entries are not included.
|
||||
|
|
|
@ -50,6 +50,12 @@ class MisCashFlow(models.Model):
|
|||
account_internal_type = fields.Selection(
|
||||
related="account_id.user_type_id.type", readonly=True
|
||||
)
|
||||
state = fields.Selection(selection="_selection_parent_state",)
|
||||
|
||||
def _selection_parent_state(self):
|
||||
return self.env["account.move"].fields_get(allfields=["state"])["state"][
|
||||
"selection"
|
||||
]
|
||||
|
||||
def init(self):
|
||||
query = """
|
||||
|
@ -75,6 +81,7 @@ class MisCashFlow(models.Model):
|
|||
aml.partner_id as partner_id,
|
||||
aml.company_id as company_id,
|
||||
aml.name as name,
|
||||
aml.parent_state as state,
|
||||
COALESCE(aml.date_maturity, aml.date) as date
|
||||
FROM account_move_line as aml
|
||||
WHERE aml.parent_state != 'cancel'
|
||||
|
@ -99,6 +106,7 @@ class MisCashFlow(models.Model):
|
|||
fl.partner_id as partner_id,
|
||||
fl.company_id as company_id,
|
||||
fl.name as name,
|
||||
'posted' as state,
|
||||
fl.date as date
|
||||
FROM mis_cash_flow_forecast_line as fl
|
||||
"""
|
||||
|
|
|
@ -394,6 +394,10 @@ The forecast is based on two types of date:</p>
|
|||
<ol class="arabic simple">
|
||||
<li>Go to Accounting > Reports > MIS Reporting > MIS Reports and choose “Cash Flow” report</li>
|
||||
<li>You can add forecast lines on Accounting > Reports > MIS Reporting > Cash Flow Forecast Line</li>
|
||||
<li>If you select on “Target Moves” the value “All Posted Entries”, you will get only
|
||||
lines for already posted invoices/entries + the forecast lines.</li>
|
||||
<li>Selecting “All Entries”, draft invoices/entries are also included.</li>
|
||||
<li>In any case, cancelled invoices/entries are not included.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
|
@ -424,6 +428,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li>Juan José Scarafía <<a class="reference external" href="mailto:jjs@adhoc.com.ar">jjs@adhoc.com.ar</a>></li>
|
||||
<li>Gonzalo Ruzafa <<a class="reference external" href="mailto:gr@adhoc.com.ar">gr@adhoc.com.ar</a>></li>
|
||||
<li>Alberto Martín <<a class="reference external" href="mailto:alberto.martin@guadaltech.es">alberto.martin@guadaltech.es</a>></li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Pedro M. Baeza</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
|
Loading…
Reference in New Issue