Skip to content

Commit

Permalink
[IMP] l10n_it_riba: add possibility to change riba payments date
Browse files Browse the repository at this point in the history
  • Loading branch information
odooNextev authored and toita86 committed Nov 26, 2024
1 parent 12d0c6d commit 28b4471
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 2 deletions.
6 changes: 6 additions & 0 deletions l10n_it_ricevute_bancarie/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ Nella lista delle fatture è presente una colonna per monitorare l'
esposizione, cioè l'importo dovuto dal cliente a fronte dell'emissione
della RiBa non ancora scaduta.

In maniera predefinita la data delle registrazioni dei pagamenti viene
impostata con la data di scadenza della RiBa, ma è possibile modificarla
successivamente a pagamento effettivamente avvenuto selezionando la
registrazione dalla vista ed elenco ed eseguendo l'azione "Imposta data
di pagamento RiBa".

Known issues / Roadmap
======================

Expand Down
1 change: 1 addition & 0 deletions l10n_it_ricevute_bancarie/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"views/partner_view.xml",
"views/wizard_riba_issue.xml",
"views/wizard_riba_file_export.xml",
"views/wizard_riba_payment_date.xml",
"views/account_config_view.xml",
"views/distinta_report.xml",
"views/riba_detail_view.xml",
Expand Down
10 changes: 10 additions & 0 deletions l10n_it_ricevute_bancarie/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ def copy(self, default=None):
def get_due_cost_line_ids(self):
return self.invoice_line_ids.filtered(lambda l: l.due_cost_line).ids

def action_riba_payment_date(self):
return {

Check warning on line 291 in l10n_it_ricevute_bancarie/models/account.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_ricevute_bancarie/models/account.py#L291

Added line #L291 was not covered by tests
"type": "ir.actions.act_window",
"name": "RiBa Payment Date",
"res_model": "riba.payment.date",
"view_mode": "form",
"target": "new",
"context": self.env.context,
}


# se distinta_line_ids == None allora non è stata emessa
class AccountMoveLine(models.Model):
Expand Down
3 changes: 1 addition & 2 deletions l10n_it_ricevute_bancarie/models/riba.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Copyright (C) 2012-2017 Lorenzo Battistini - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from datetime import date

from odoo import _, api, fields, models
from odoo.exceptions import Warning as UserError
Expand Down Expand Up @@ -510,7 +509,7 @@ def riba_line_settlement(self):
"journal_id": (
riba_line.distinta_id.config_id.settlement_journal_id.id
),
"date": date.today().strftime("%Y-%m-%d"),
"date": riba_line.due_date.strftime("%Y-%m-%d"),
"ref": move_ref,
}
)
Expand Down
6 changes: 6 additions & 0 deletions l10n_it_ricevute_bancarie/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ cliccare su 'Presentazione Riba' tra le azioni.
Nella lista delle fatture è presente una colonna per monitorare l'
esposizione, cioè l'importo dovuto dal cliente a fronte dell'emissione
della RiBa non ancora scaduta.

In maniera predefinita la data delle registrazioni dei pagamenti viene
impostata con la data di scadenza della RiBa, ma è possibile modificarla
successivamente a pagamento effettivamente avvenuto selezionando la
registrazione dalla vista ed elenco ed eseguendo l'azione "Imposta data
di pagamento RiBa".
1 change: 1 addition & 0 deletions l10n_it_ricevute_bancarie/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ access_riba_accreditation,riba_accreditation,model_riba_accreditation,account.gr
access_riba_file_export,riba_file_export,model_riba_file_export,account.group_account_invoice,1,1,1,1
access_presentation_riba_issue,access_presentation_riba_issue,model_presentation_riba_issue,account.group_account_invoice,1,1,1,1
access_riba_due_date_settlement,riba_due_date_settlement,model_riba_due_date_settlement,account.group_account_invoice,1,1,1,1
access_riba_payment_date,riba_payment_date,model_riba_payment_date,account.group_account_invoice,1,1,1,1
5 changes: 5 additions & 0 deletions l10n_it_ricevute_bancarie/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>Nella lista delle fatture è presente una colonna per monitorare l’
esposizione, cioè l’importo dovuto dal cliente a fronte dell’emissione
della RiBa non ancora scaduta.</p>
<p>In maniera predefinita la data delle registrazioni dei pagamenti viene
impostata con la data di scadenza della RiBa, ma è possibile modificarla
successivamente a pagamento effettivamente avvenuto selezionando la
registrazione dalla vista ed elenco ed eseguendo l’azione “Imposta data
di pagamento RiBa”.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
Expand Down
37 changes: 37 additions & 0 deletions l10n_it_ricevute_bancarie/views/wizard_riba_payment_date.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
~ Copyright 2024 Nextev Srl
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="wizard_riba_payment_date" model="ir.ui.view">
<field name="name">Set RiBa Payment Date</field>
<field name="model">riba.payment.date</field>
<field name="arch" type="xml">
<form string="Set RiBa Payment Date">
<group col="4">
<group colspan="4">
<field name="date" />
</group>
<footer colspan="4">
<button
name="set_riba_payment_date"
string="Confirm"
type="object"
/>
<button special="cancel" string="Close" />
</footer>
</group>
</form>
</field>
</record>

<record id="action_riba_payment_date" model="ir.actions.server">
<field name="name">RiBa Payment Date</field>
<field name="model_id" ref="account.model_account_move" />
<field name="binding_model_id" ref="account.model_account_move" />
<field name="state">code</field>
<field name="code">action = records.action_riba_payment_date()</field>
</record>

</odoo>
1 change: 1 addition & 0 deletions l10n_it_ricevute_bancarie/wizard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
from . import wizard_unsolved
from . import wizard_presentation_riba
from . import wizard_due_date_settlement
from . import wizard_riba_payment_date
22 changes: 22 additions & 0 deletions l10n_it_ricevute_bancarie/wizard/wizard_riba_payment_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Nextev Srl
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, fields, models
from odoo.exceptions import UserError


# -------------------------------------------------------
# RIBA PAYMENT DATE
# -------------------------------------------------------
class RibaPaymentDate(models.TransientModel):
_name = "riba.payment.date"
_description = "RiBa Payment Date"

date = fields.Date(string="Payment Date", required=True)

def set_riba_payment_date(self):
active_id = self.env.context.get("active_id", False)

Check warning on line 18 in l10n_it_ricevute_bancarie/wizard/wizard_riba_payment_date.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_ricevute_bancarie/wizard/wizard_riba_payment_date.py#L18

Added line #L18 was not covered by tests
if not active_id:
raise UserError(_("No active ID found."))
move = self.env["account.move"].browse([active_id])
move.date = self.date

Check warning on line 22 in l10n_it_ricevute_bancarie/wizard/wizard_riba_payment_date.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_ricevute_bancarie/wizard/wizard_riba_payment_date.py#L20-L22

Added lines #L20 - L22 were not covered by tests

0 comments on commit 28b4471

Please sign in to comment.