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

[MIG] l10n_it_fatturapa_in_rc: Migration to 14.0 #2149

Merged
merged 10 commits into from
Mar 3, 2022
94 changes: 94 additions & 0 deletions l10n_it_fatturapa_in_rc/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
================================================
ITA - Fattura elettronica - Inversione contabile
================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/12.0/l10n_it_fatturapa_in_rc
: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-12-0/l10n-italy-12-0-l10n_it_fatturapa_in_rc
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/12.0
:alt: Try me on Runbot

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

Modulo ponte tra ricezione fatture elettroniche fornitore e inversione contabile.

Con questo modulo, l'imposta della fattura ricevuta in inversione contabile verrà
correttamente valorizzata e le righe soggette a inversione contabile identificate.

**Table of contents**

.. contents::
:local:

Configuration
=============

Creare la posizione fiscale, con il relativo tipo di inversione contabile, per gli acquisti soggetti ad inversione contabile effettuati verso fornitori italiani.

Per la configurazione del tipo di inversione contabile, si faccia riferimento alla documentazione del modulo `l10n_it_reverse_charge`.

Nel tipo di inversione contabile impostare "Fornitori e-fattura" per far sì che tale tipo venga automaticamente utilizzato in fase di importazione di fatture elettroniche.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_in_rc%0Aversion:%2012.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
~~~~~~~

* Efatto.it di Sergio Corato

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

* Sergio Corato <info@efatto.it>
* Lorenzo Battistini <https://github.com/eLBati>

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.

.. |maintainer-sergiocorato| image:: https://github.com/sergiocorato.png?size=40px
:target: https://github.com/sergiocorato
:alt: sergiocorato

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sergiocorato|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_in_rc>`_ 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 l10n_it_fatturapa_in_rc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import wizard
from . import models
24 changes: 24 additions & 0 deletions l10n_it_fatturapa_in_rc/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2018 Sergio Corato (https://efatto.it)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "ITA - Fattura elettronica - Inversione contabile",
"summary": "Modulo ponte tra e-fattura in acquisto e inversione" " contabile",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://github.com/OCA/l10n-italy" "l10n_it_fatturapa_in_rc",
"author": "Efatto.it di Sergio Corato, Odoo Community Association (OCA)",
"maintainers": ["sergiocorato"],
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": [
"l10n_it_reverse_charge",
"l10n_it_fatturapa_in",
"l10n_it_account_tax_kind",
],
"data": [
"views/rc_type_view.xml",
],
}
57 changes: 57 additions & 0 deletions l10n_it_fatturapa_in_rc/i18n/l10n_it_fatturapa_in_rc.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_fatturapa_in_rc
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \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_fatturapa_in_rc
#: model:ir.model.fields,help:l10n_it_fatturapa_in_rc.field_account_rc_type__e_invoice_suppliers
msgid "Automatically used when importing e-invoices from Italian suppliers"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: model:ir.model.fields,field_description:l10n_it_fatturapa_in_rc.field_account_rc_type__e_invoice_suppliers
msgid "E-invoice suppliers"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: model:ir.model,name:l10n_it_fatturapa_in_rc.model_wizard_import_fatturapa
msgid "Import E-bill"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: model:ir.model,name:l10n_it_fatturapa_in_rc.model_account_invoice
msgid "Invoice"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: model:ir.model,name:l10n_it_fatturapa_in_rc.model_account_invoice_line
msgid "Invoice Line"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: model:ir.model,name:l10n_it_fatturapa_in_rc.model_account_rc_type
msgid "Reverse Charge Type"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: code:addons/l10n_it_fatturapa_in_rc/models/account_invoice.py:36
#, python-format
msgid "Taxed amount ({bill_amount_tax}) does not match with e-bill taxed amount ({e_bill_amount_tax})"
msgstr ""

#. module: l10n_it_fatturapa_in_rc
#: code:addons/l10n_it_fatturapa_in_rc/models/account_invoice.py:60
#, python-format
msgid "Total amount ({bill_amount_total}) does not match with e-bill total amount ({e_bill_amount_total})"
msgstr ""

2 changes: 2 additions & 0 deletions l10n_it_fatturapa_in_rc/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_rc_type
from . import account_invoice
68 changes: 68 additions & 0 deletions l10n_it_fatturapa_in_rc/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from odoo import _, models
from odoo.tools import float_compare


class InvoiceLine(models.Model):
_inherit = "account.move.line"

def _set_rc_flag(self, invoice):
self.ensure_one()
if "fatturapa.attachment.in" in self.env.context.get("active_model", []):
# this means we are importing an e-invoice,
# so RC flag is already set, where needed
return
return super(InvoiceLine, self)._set_rc_flag(invoice)


class Invoice(models.Model):
_inherit = "account.move"

def e_inv_check_amount_tax(self):
if any(self.invoice_line_ids.mapped("rc")) and self.e_invoice_amount_tax:
error_message = ""
amount_added_for_rc = self.get_tax_amount_added_for_rc()
amount_tax = self.amount_tax - amount_added_for_rc
if (
float_compare(
amount_tax,
self.e_invoice_amount_tax,
precision_rounding=self.currency_id.rounding,
)
!= 0
):
error_message = _(
"Taxed amount ({bill_amount_tax}) "
"does not match with "
"e-bill taxed amount ({e_bill_amount_tax})"
).format(
bill_amount_tax=amount_tax or 0,
e_bill_amount_tax=self.e_invoice_amount_tax,
)
return error_message
else:
return super(Invoice, self).e_inv_check_amount_tax()

def e_inv_check_amount_total(self):
if any(self.invoice_line_ids.mapped("rc")) and self.e_invoice_amount_total:
error_message = ""
amount_added_for_rc = self.get_tax_amount_added_for_rc()
amount_total = self.amount_total - amount_added_for_rc
if (
float_compare(
amount_total,
self.e_invoice_amount_total,
precision_rounding=self.currency_id.rounding,
)
!= 0
):
error_message = _(
"Total amount ({bill_amount_total}) "
"does not match with "
"e-bill total amount ({e_bill_amount_total})"
).format(
bill_amount_total=amount_total or 0,
e_bill_amount_total=self.e_invoice_amount_total,
)
return error_message
else:
return super(Invoice, self).e_inv_check_amount_total()
10 changes: 10 additions & 0 deletions l10n_it_fatturapa_in_rc/models/account_rc_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class RCType(models.Model):
_inherit = "account.rc.type"

e_invoice_suppliers = fields.Boolean(
"E-invoice suppliers",
help="Automatically used when importing e-invoices from Italian " "suppliers",
)
5 changes: 5 additions & 0 deletions l10n_it_fatturapa_in_rc/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Creare la posizione fiscale, con il relativo tipo di inversione contabile, per gli acquisti soggetti ad inversione contabile effettuati verso fornitori italiani.

Per la configurazione del tipo di inversione contabile, si faccia riferimento alla documentazione del modulo `l10n_it_reverse_charge`.

Nel tipo di inversione contabile impostare "Fornitori e-fattura" per far sì che tale tipo venga automaticamente utilizzato in fase di importazione di fatture elettroniche.
3 changes: 3 additions & 0 deletions l10n_it_fatturapa_in_rc/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Sergio Corato <info@efatto.it>
* Lorenzo Battistini <https://github.com/eLBati>
* Marco Colombo <https://github.com/TheMule71>
4 changes: 4 additions & 0 deletions l10n_it_fatturapa_in_rc/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Modulo ponte tra ricezione fatture elettroniche fornitore e inversione contabile.

Con questo modulo, l'imposta della fattura ricevuta in inversione contabile verrà
correttamente valorizzata e le righe soggette a inversione contabile identificate.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading