diff --git a/l10n_it_vat_registries_split_payment/README.rst b/l10n_it_vat_registries_split_payment/README.rst new file mode 100644 index 000000000000..fa0600372d31 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/README.rst @@ -0,0 +1,82 @@ +============================================ +ITA - Registro IVA + Scissione dei pagamenti +============================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/16.0/l10n_it_vat_registries_split_payment + :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-16-0/l10n-italy-16-0-l10n_it_vat_registries_split_payment + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-italy&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Modulo di congiunzione tra le funzionalità legate ai registri IVA e le +funzionalità inerenti alla scissione dei pagamenti. + +**English** + +Bridge module to make "VAT Registries" module work along with "Split Payment" +module. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Agile Business Group + +Contributors +~~~~~~~~~~~~ + +* Lorenzo Battistini +* Matteo Bilotta + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_vat_registries_split_payment/__init__.py b/l10n_it_vat_registries_split_payment/__init__.py new file mode 100644 index 000000000000..9dda666c2631 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import report diff --git a/l10n_it_vat_registries_split_payment/__manifest__.py b/l10n_it_vat_registries_split_payment/__manifest__.py new file mode 100644 index 000000000000..7e46f65fa27f --- /dev/null +++ b/l10n_it_vat_registries_split_payment/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2018 Lorenzo Battistini +# Copyright (c) 2019 Matteo Bilotta +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "ITA - Registro IVA + Scissione dei pagamenti", + "summary": "Modulo di congiunzione tra registri" " IVA e scissione dei pagamenti", + "version": "16.0.1.0.0", + "development_status": "Beta", + "category": "Accounting & Finance", + "website": "https://github.com/OCA/l10n-italy", + "author": "Agile Business Group, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "auto_install": True, + "depends": ["l10n_it_vat_registries", "l10n_it_split_payment"], +} diff --git a/l10n_it_vat_registries_split_payment/i18n/it.po b/l10n_it_vat_registries_split_payment/i18n/it.po new file mode 100644 index 000000000000..78d6c07958b1 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/i18n/it.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_vat_registries_split_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-04-07 18:22+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva__id +msgid "ID" +msgstr "ID" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model,name:l10n_it_vat_registries_split_payment.model_report_l10n_it_vat_registries_report_registro_iva +msgid "Report VAT registry" +msgstr "Resoconto registro IVA" diff --git a/l10n_it_vat_registries_split_payment/i18n/l10n_it_vat_registries_split_payment.pot b/l10n_it_vat_registries_split_payment/i18n/l10n_it_vat_registries_split_payment.pot new file mode 100644 index 000000000000..d42a2f9868ee --- /dev/null +++ b/l10n_it_vat_registries_split_payment/i18n/l10n_it_vat_registries_split_payment.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_vat_registries_split_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva__id +msgid "ID" +msgstr "" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model.fields,field_description:l10n_it_vat_registries_split_payment.field_report_l10n_it_vat_registries_report_registro_iva____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_it_vat_registries_split_payment +#: model:ir.model,name:l10n_it_vat_registries_split_payment.model_report_l10n_it_vat_registries_report_registro_iva +msgid "Report VAT registry" +msgstr "" diff --git a/l10n_it_vat_registries_split_payment/readme/CONTRIBUTORS.rst b/l10n_it_vat_registries_split_payment/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..69aa5ff06a97 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Lorenzo Battistini +* Matteo Bilotta diff --git a/l10n_it_vat_registries_split_payment/readme/DESCRIPTION.rst b/l10n_it_vat_registries_split_payment/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..161a6ed65e18 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +**Italiano** + +Modulo di congiunzione tra le funzionalità legate ai registri IVA e le +funzionalità inerenti alla scissione dei pagamenti. + +**English** + +Bridge module to make "VAT Registries" module work along with "Split Payment" +module. diff --git a/l10n_it_vat_registries_split_payment/report/__init__.py b/l10n_it_vat_registries_split_payment/report/__init__.py new file mode 100644 index 000000000000..86d932de5fc0 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/report/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import report_vat_registry diff --git a/l10n_it_vat_registries_split_payment/report/report_vat_registry.py b/l10n_it_vat_registries_split_payment/report/report_vat_registry.py new file mode 100644 index 000000000000..b7e29243cee6 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/report/report_vat_registry.py @@ -0,0 +1,21 @@ +# Copyright (c) 2019 Matteo Bilotta +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class ReportVatRegistry(models.AbstractModel): + _inherit = "report.l10n_it_vat_registries.report_registro_iva" + + @api.model + def _compute_totals_tax(self, tax, data): + res = super()._compute_totals_tax(tax, data) + + if tax.is_split_payment: + # res = (tax_name, base, tax, deductible, undeductible) + # + # In case of SP tax, SP VAT must not appear as deductible. + # + return (res[0], res[1], res[2], 0.0, res[4]) + + return res diff --git a/l10n_it_vat_registries_split_payment/static/description/icon.png b/l10n_it_vat_registries_split_payment/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/l10n_it_vat_registries_split_payment/static/description/icon.png differ diff --git a/l10n_it_vat_registries_split_payment/static/description/index.html b/l10n_it_vat_registries_split_payment/static/description/index.html new file mode 100644 index 000000000000..58d65e999583 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +ITA - Registro IVA + Scissione dei pagamenti + + + +
+

ITA - Registro IVA + Scissione dei pagamenti

+ + +

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runboat

+

Italiano

+

Modulo di congiunzione tra le funzionalità legate ai registri IVA e le +funzionalità inerenti alla scissione dei pagamenti.

+

English

+

Bridge module to make “VAT Registries” module work along with “Split Payment” +module.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Agile Business Group
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_it_vat_registries_split_payment/tests/__init__.py b/l10n_it_vat_registries_split_payment/tests/__init__.py new file mode 100644 index 000000000000..ed30c68e3d31 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sp diff --git a/l10n_it_vat_registries_split_payment/tests/test_sp.py b/l10n_it_vat_registries_split_payment/tests/test_sp.py new file mode 100644 index 000000000000..84ea8fd222c2 --- /dev/null +++ b/l10n_it_vat_registries_split_payment/tests/test_sp.py @@ -0,0 +1,181 @@ +from odoo import fields +from odoo.tests import Form, tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestSP(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls, chart_template_ref=None): + super().setUpClass(chart_template_ref=chart_template_ref) + cls.account_model = cls.env["account.account"] + cls.tax_model = cls.env["account.tax"] + cls.invoice_model = cls.env["account.move"] + cls.inv_line_model = cls.env["account.move.line"] + cls.fp_model = cls.env["account.fiscal.position"] + cls.tax_received = cls.account_model.search( + [("name", "=", "Tax Received"), ("company_id", "=", cls.env.company.id)] + ) + cls.tax22sp = cls.tax_model.create( + { + "name": "22% SP", + "amount": 22, + "invoice_repartition_line_ids": [ + (5, 0, 0), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "base", + }, + ), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "tax", + "account_id": cls.tax_received.id, + }, + ), + ], + "refund_repartition_line_ids": [ + (5, 0, 0), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "base", + }, + ), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "tax", + "account_id": cls.tax_received.id, + }, + ), + ], + } + ) + cls.tax22 = cls.tax_model.create( + { + "name": "22%", + "amount": 22, + "invoice_repartition_line_ids": [ + (5, 0, 0), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "base", + }, + ), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "tax", + "account_id": cls.tax_received.id, + }, + ), + ], + "refund_repartition_line_ids": [ + (5, 0, 0), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "base", + }, + ), + ( + 0, + 0, + { + "factor_percent": 100, + "repartition_type": "tax", + "account_id": cls.tax_received.id, + }, + ), + ], + } + ) + cls.sp_fp = cls.fp_model.create( + { + "name": "Split payment", + "split_payment": True, + "tax_ids": [ + ( + 0, + 0, + {"tax_src_id": cls.tax22.id, "tax_dest_id": cls.tax22sp.id}, + ) + ], + } + ) + cls.company = cls.env.company + cls.company.sp_account_id = cls.env["account.account"].search( + [ + ( + "account_type", + "=", + "asset_current", + ) + ], + limit=1, + ) + cls.a_sale = cls.env["account.account"].search( + [ + ( + "account_type", + "=", + "income", + ) + ], + limit=1, + ) + cls.invoice_date = fields.Date.today() + + def test_invoice(self): + partner = self.env.ref("base.res_partner_3") + + for tax in (self.tax22, self.tax22sp): + invoice = self.init_invoice( + "out_invoice", + partner=partner, + invoice_date=self.invoice_date, + amounts=[100], + taxes=tax, + ) + invoice_form = Form(invoice) + invoice_form.fiscal_position_id = self.sp_fp + invoice = invoice_form.save() + invoice.action_post() + + data = { + "from_date": self.invoice_date, + "to_date": self.invoice_date, + } + totals_standard_sp = self.tax22sp._compute_totals_tax(data) + totals_standard = self.tax22._compute_totals_tax(data) + + self.assertEqual(totals_standard_sp, ("22% SP", 100.0, 22.0, 22.0, 0)) + self.assertEqual(totals_standard, ("22%", 100.0, 22.0, 22.0, 0)) + + report_vat_registry = self.env[ + "report.l10n_it_vat_registries.report_registro_iva" + ] + totals_registry_sp = report_vat_registry._compute_totals_tax(self.tax22sp, data) + totals_registry = report_vat_registry._compute_totals_tax(self.tax22, data) + + self.assertEqual(totals_registry_sp, ("22% SP", 100.0, 22.0, 0.0, 0)) + self.assertEqual(totals_registry, ("22%", 100.0, 22.0, 22.0, 0)) diff --git a/setup/l10n_it_vat_registries_split_payment/odoo/addons/l10n_it_vat_registries_split_payment b/setup/l10n_it_vat_registries_split_payment/odoo/addons/l10n_it_vat_registries_split_payment new file mode 120000 index 000000000000..c7f7b515b0c0 --- /dev/null +++ b/setup/l10n_it_vat_registries_split_payment/odoo/addons/l10n_it_vat_registries_split_payment @@ -0,0 +1 @@ +../../../../l10n_it_vat_registries_split_payment \ No newline at end of file diff --git a/setup/l10n_it_vat_registries_split_payment/setup.py b/setup/l10n_it_vat_registries_split_payment/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_vat_registries_split_payment/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)