Skip to content

[IMP] Identificare le righe delle RiBa nell'estratto conto in sospeso del partner #4773

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

Open
wants to merge 2 commits into
base: 14.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
84 changes: 84 additions & 0 deletions l10n_it_partner_statement_riba/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
==================================================
ITA - Estratti conto cliente con ricevute bancarie
==================================================

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

.. |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%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_partner_statement_riba
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_partner_statement_riba
: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/l10n-italy&target_branch=14.0
:alt: Try me on Runboat

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

**Italiano**

Nell'estratto conto in sospeso del partner, permette di mostrare se la fattura è ancora in sospeso perché collegata a una RiBa da pagare o insoluta.

**English**

In the partner's oustanding statement, allow to show if the Invoice is still due because the linked RiBa is to be paid or unsolved.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/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/l10n-italy/issues/new?body=module:%20l10n_it_partner_statement_riba%0Aversion:%2014.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
~~~~~~~

* PyTech

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

* `PyTech <https://www.pytech.it>`_:

* Simone Rubino <simone.rubino@pytech.it>

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/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_partner_statement_riba>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions l10n_it_partner_statement_riba/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import reports
from . import wizards
20 changes: 20 additions & 0 deletions l10n_it_partner_statement_riba/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 Simone Rubino - PyTech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "ITA - Estratti conto cliente con ricevute bancarie",
"version": "14.0.1.0.0",
"author": "PyTech, Odoo Community Association (OCA)",
"category": "Localization/Italy",
"summary": "Visualizzare le RiBa negli estratti conto cliente.",
"website": "https://github.com/OCA/l10n-italy",
"license": "AGPL-3",
"depends": [
"l10n_it_ricevute_bancarie",
"partner_statement",
],
"data": [
"reports/outstanding_statement.xml",
"wizards/outstanding_statement_views.xml",
],
}
72 changes: 72 additions & 0 deletions l10n_it_partner_statement_riba/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_partner_statement_riba
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-22 15:52+0000\n"
"PO-Revision-Date: 2025-05-22 15:52+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_it_partner_statement_riba
#: model:ir.model.fields,help:l10n_it_partner_statement_riba.field_outstanding_statement_wizard__l10n_it_show_riba
msgid ""
"Add a column in the statements to identify the lines that come from RiBa."
msgstr ""
"Aggiunge una colonna nei resoconti per identificare le righe causate dalle RiBa."

#. module: l10n_it_partner_statement_riba
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_outstanding_statement_wizard__display_name
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_p_s_report_outstanding_statement_xlsx__display_name
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_partner_statement_outstanding_statement__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: l10n_it_partner_statement_riba
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_outstanding_statement_wizard__id
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_p_s_report_outstanding_statement_xlsx__id
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_partner_statement_outstanding_statement__id
msgid "ID"
msgstr ""

#. module: l10n_it_partner_statement_riba
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_outstanding_statement_wizard____last_update
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_p_s_report_outstanding_statement_xlsx____last_update
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_report_partner_statement_outstanding_statement____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: l10n_it_partner_statement_riba
#: model:ir.model,name:l10n_it_partner_statement_riba.model_outstanding_statement_wizard
msgid "Outstanding Statement Wizard"
msgstr "Procedura guidata estratto conto in sospeso"

#. module: l10n_it_partner_statement_riba
#: model:ir.model,name:l10n_it_partner_statement_riba.model_report_p_s_report_outstanding_statement_xlsx
msgid "Outstanding Statement XLSL Report"
msgstr "Rendiconto XLSX estratti conto in sospeso"

#. module: l10n_it_partner_statement_riba
#: model:ir.model,name:l10n_it_partner_statement_riba.model_report_partner_statement_outstanding_statement
msgid "Partner Outstanding Statement"
msgstr "Estratto conto in sospeso partner"

#. module: l10n_it_partner_statement_riba
#: code:addons/l10n_it_partner_statement_riba/reports/outstanding_statement_xlsx.py:0
#: code:addons/l10n_it_partner_statement_riba/tests/test_outstanding_statement.py:0
#: model_terms:ir.ui.view,arch_db:l10n_it_partner_statement_riba.outstanding_balance
#, python-format
msgid "RiBa"
msgstr ""

#. module: l10n_it_partner_statement_riba
#: model:ir.model.fields,field_description:l10n_it_partner_statement_riba.field_outstanding_statement_wizard__l10n_it_show_riba
msgid "Show RiBa"
msgstr "Mostrare RiBa"
3 changes: 3 additions & 0 deletions l10n_it_partner_statement_riba/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `PyTech <https://www.pytech.it>`_:

* Simone Rubino <simone.rubino@pytech.it>
7 changes: 7 additions & 0 deletions l10n_it_partner_statement_riba/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Italiano**

Nell'estratto conto in sospeso del partner, permette di mostrare se la fattura è ancora in sospeso perché collegata a una RiBa da pagare o insoluta.

**English**

In the partner's oustanding statement, allow to show if the Invoice is still due because the linked RiBa is to be paid or unsolved.
4 changes: 4 additions & 0 deletions l10n_it_partner_statement_riba/reports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import outstanding_statement_xlsx
from . import outstanding_statement
33 changes: 33 additions & 0 deletions l10n_it_partner_statement_riba/reports/outstanding_statement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2025 Simone Rubino - PyTech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class OutstandingStatementReport(models.AbstractModel):
_inherit = "report.partner_statement.outstanding_statement"

@api.model
def _l10n_it_riba_inject_report_values(self, report_values):
"""Include in `report_values` values for RiBa."""
for _partner_id, partner_data in report_values["data"].items():
currencies = partner_data.get("currencies", {})
for _currency_id, currency_data in currencies.items():
for line in currency_data.get("lines", []):
move_line = self.env["account.move.line"].browse(line["id"])
move = move_line.move_id
# account.move.open_amount cannot be included
# in the report queries
# because is computed and not stored
line["l10n_it_riba_open"] = move.is_unsolved or move.open_amount
return report_values

@api.model
def _get_report_values(self, docids, data=None):
report_values = super()._get_report_values(docids, data=data)
report_values["l10n_it_show_riba"] = data["l10n_it_show_riba"]
if report_values["l10n_it_show_riba"]:
report_values = self._l10n_it_riba_inject_report_values(
report_values,
)
return report_values
35 changes: 35 additions & 0 deletions l10n_it_partner_statement_riba/reports/outstanding_statement.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
~ Copyright 2025 Simone Rubino - PyTech
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<template
id="outstanding_balance"
inherit_id="partner_statement.outstanding_balance"
>
<xpath
expr="//table[hasclass('table-statement')]/thead/tr/th[last()]"
position="before"
>
<th t-if="l10n_it_show_riba" name="l10n_it_riba_state_th">
RiBa
</th>
</xpath>
<xpath
expr="//table[hasclass('table-statement')]/tbody/tr[1]/td[last()]"
position="before"
>
<td t-if="l10n_it_show_riba" name="l10n_it_riba_state_td">
<span t-if="line['l10n_it_riba_open']" class="fa fa-check" />
</td>
</xpath>
<!-- The last line shows the total, add an empty cell to keep it aligned. -->
<xpath
expr="//table[hasclass('table-statement')]/tbody/tr[last()]/td[last()]"
position="before"
>
<td t-if="l10n_it_show_riba" name="l10n_it_riba_state_last_td" />
</xpath>
</template>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2025 Simone Rubino - PyTech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, models

from odoo.addons.report_xlsx_helper.report.report_xlsx_format import FORMATS


class OutstandingStatementXslx(models.AbstractModel):
_inherit = "report.p_s.report_outstanding_statement_xlsx"

def _get_currency_header_row_data(self, partner, currency, data):
row_data = super()._get_currency_header_row_data(partner, currency, data)
if data["l10n_it_show_riba"]:
last_col_pos = row_data[-1]["col_pos"]
row_data.insert(
-1,
{
"col_pos": last_col_pos,
"sheet_func": "write",
"args": (_("RiBa"), FORMATS["format_theader_yellow_center"]),
},
)
row_data[-1]["col_pos"] = last_col_pos + 1
return row_data

def _get_currency_line_row_data(self, partner, currency, data, line):
row_data = super()._get_currency_line_row_data(partner, currency, data, line)
if data["l10n_it_show_riba"]:
if line.get("blocked"):
format_distributed = FORMATS["format_distributed_blocked"]

Check warning on line 31 in l10n_it_partner_statement_riba/reports/outstanding_statement_xlsx.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_partner_statement_riba/reports/outstanding_statement_xlsx.py#L31

Added line #L31 was not covered by tests
else:
format_distributed = FORMATS["format_distributed"]

move_line = self.env["account.move.line"].browse(line["id"])
move = move_line.move_id
# account.move.open_amount cannot be included
# in the report queries
# because is computed and not stored
is_riba_open = move.is_unsolved or move.open_amount
last_col_pos = row_data[-1]["col_pos"]
row_data.insert(
-1,
{
"col_pos": last_col_pos,
"sheet_func": "write",
"args": ("X" if is_riba_open else "", format_distributed),
},
)
row_data[-1]["col_pos"] = last_col_pos + 1
return row_data

def _get_currency_footer_row_data(self, partner, currency, data):
row_data = super()._get_currency_footer_row_data(partner, currency, data)
if data["l10n_it_show_riba"]:
row_data[-1]["col_pos"] += 1
return row_data
Loading