diff --git a/l10n_it_fatturapa_out_sp/README.rst b/l10n_it_fatturapa_out_sp/README.rst new file mode 100644 index 00000000000..130f2129838 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/README.rst @@ -0,0 +1,79 @@ +=========================================================== +ITA - Fattura elettronica - Emissione - Scissione 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_fatturapa_out_sp + :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_fatturapa_out_sp + :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 tecnico di integrazione tra l10n_it_split_payment e l10n_it_fatturapa_out + +**English** + +Technical module for integrating l10n_it_split_payment and l10n_it_fatturapa_out + +**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 +~~~~~~~ + +* Marco Colombo + +Contributors +~~~~~~~~~~~~ + +* Marco Colombo + +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_fatturapa_out_sp/__init__.py b/l10n_it_fatturapa_out_sp/__init__.py new file mode 100644 index 00000000000..4b19b1a7002 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2022 Marco Colombo + +from . import wizard diff --git a/l10n_it_fatturapa_out_sp/__manifest__.py b/l10n_it_fatturapa_out_sp/__manifest__.py new file mode 100644 index 00000000000..dd3bda6659b --- /dev/null +++ b/l10n_it_fatturapa_out_sp/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2020 Marco Colombo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "ITA - Fattura elettronica - Emissione - Scissione Pagamenti", + "version": "16.0.1.0.0", + "development_status": "Beta", + "category": "Localization/Italy", + "summary": "Scissione pagamenti in fatturapa", + "author": "Marco Colombo," "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy", + "license": "AGPL-3", + "depends": [ + "l10n_it_fatturapa_out", + "l10n_it_split_payment", + ], + "installable": True, + "auto_install": True, +} diff --git a/l10n_it_fatturapa_out_sp/i18n/it.po b/l10n_it_fatturapa_out_sp/i18n/it.po new file mode 100644 index 00000000000..5e54ba81eba --- /dev/null +++ b/l10n_it_fatturapa_out_sp/i18n/it.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_out_sp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-10-10 09:34+0000\n" +"Last-Translator: Sergio Zanchetta \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.3.2\n" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model,name:l10n_it_fatturapa_out_sp.model_wizard_export_fatturapa +msgid "Export E-invoice" +msgstr "Esporta e-fattura" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa__id +msgid "ID" +msgstr "ID" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" diff --git a/l10n_it_fatturapa_out_sp/i18n/l10n_it_fatturapa_out_sp.pot b/l10n_it_fatturapa_out_sp/i18n/l10n_it_fatturapa_out_sp.pot new file mode 100644 index 00000000000..b3efdcaa6e3 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/i18n/l10n_it_fatturapa_out_sp.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_out_sp +# +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_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model,name:l10n_it_fatturapa_out_sp.model_wizard_export_fatturapa +msgid "Export E-invoice" +msgstr "" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa__id +msgid "ID" +msgstr "" + +#. module: l10n_it_fatturapa_out_sp +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_sp.field_wizard_export_fatturapa____last_update +msgid "Last Modified on" +msgstr "" diff --git a/l10n_it_fatturapa_out_sp/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_out_sp/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..52f069250ac --- /dev/null +++ b/l10n_it_fatturapa_out_sp/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Marco Colombo diff --git a/l10n_it_fatturapa_out_sp/readme/DESCRIPTION.rst b/l10n_it_fatturapa_out_sp/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..53e1c1e3c3b --- /dev/null +++ b/l10n_it_fatturapa_out_sp/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +**Italiano** + +Modulo tecnico di integrazione tra l10n_it_split_payment e l10n_it_fatturapa_out + +**English** + +Technical module for integrating l10n_it_split_payment and l10n_it_fatturapa_out diff --git a/l10n_it_fatturapa_out_sp/static/description/icon.png b/l10n_it_fatturapa_out_sp/static/description/icon.png new file mode 100644 index 00000000000..1f07394c3b7 Binary files /dev/null and b/l10n_it_fatturapa_out_sp/static/description/icon.png differ diff --git a/l10n_it_fatturapa_out_sp/static/description/index.html b/l10n_it_fatturapa_out_sp/static/description/index.html new file mode 100644 index 00000000000..0cea90a677e --- /dev/null +++ b/l10n_it_fatturapa_out_sp/static/description/index.html @@ -0,0 +1,422 @@ + + + + + + +ITA - Fattura elettronica - Emissione - Scissione Pagamenti + + + +
+

ITA - Fattura elettronica - Emissione - Scissione Pagamenti

+ + +

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

+

Italiano

+

Modulo tecnico di integrazione tra l10n_it_split_payment e l10n_it_fatturapa_out

+

English

+

Technical module for integrating l10n_it_split_payment and l10n_it_fatturapa_out

+

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

+
    +
  • Marco Colombo
  • +
+
+ +
+

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_fatturapa_out_sp/tests/__init__.py b/l10n_it_fatturapa_out_sp/tests/__init__.py new file mode 100644 index 00000000000..c4c14b87a47 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/tests/__init__.py @@ -0,0 +1,2 @@ +from . import fatturapa_common +from . import test_fatturapa_xml_validation diff --git a/l10n_it_fatturapa_out_sp/tests/data/IT06363391001_00004.xml b/l10n_it_fatturapa_out_sp/tests/data/IT06363391001_00004.xml new file mode 100644 index 00000000000..c8394fdf4fe --- /dev/null +++ b/l10n_it_fatturapa_out_sp/tests/data/IT06363391001_00004.xml @@ -0,0 +1,106 @@ + + + + + + IT + 06363391001 + + 00004 + FPA12 + UFPQ1O + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 06363391001 + + 06363391001 + + Public Administration + + + + Via Roma, 1 + 10100 + Torino + AK + IT + + + + + + + TD01 + EUR + 2016-06-15 + INV/2016/0016 + 17.08 + SI + + + + + 1 + Mouse, Optical + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + + + 2 + Zed+ Antivirus + 1.000 + Unit(s) + 4.00000 + 4.00 + 22.00 + + + 22.00 + 14.00 + 3.08 + S + + + + TP02 + + MP05 + 2016-07-31 + 14.00 + + + + diff --git a/l10n_it_fatturapa_out_sp/tests/fatturapa_common.py b/l10n_it_fatturapa_out_sp/tests/fatturapa_common.py new file mode 100644 index 00000000000..7e50ec8fbe4 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/tests/fatturapa_common.py @@ -0,0 +1,54 @@ +from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import ( + FatturaPACommon as _FatturaPACommon, +) + + +class FatturaPACommon(_FatturaPACommon): + def setUp(self): + super().setUp() + + def _fix_payability(tax, ref): + reftax = self.env.ref(ref).sudo() + tax.payability = reftax.payability + + # XXX - to be moved to l10n_it_fatturapa_out.tests.fatturapa_common ? + _fix_payability(self.tax_22, "l10n_it_fatturapa.tax_22") + _fix_payability(self.tax_10, "l10n_it_fatturapa.tax_10") + _fix_payability(self.tax_22_SP, "l10n_it_fatturapa.tax_22_SP") + + self.fiscal_position_sp = self.env["account.fiscal.position"].create( + { + "name": "Split payment", + "split_payment": True, + "tax_ids": [ + ( + 0, + 0, + { + "tax_src_id": self.tax_22.id, + "tax_dest_id": self.tax_22_SP.id, + }, + ) + ], + } + ) + self.company.sp_account_id = self.env["account.account"].search( + [ + ( + "account_type", + "=", + "asset_current", + ) + ], + limit=1, + ) + + def getAttachment(self, name, module_name=None): + if module_name is None: + module_name = "l10n_it_fatturapa_out_sp" + return super().getAttachment(name, module_name) + + def getFile(self, filename, module_name=None): + if module_name is None: + module_name = "l10n_it_fatturapa_out_sp" + return super().getFile(filename, module_name) diff --git a/l10n_it_fatturapa_out_sp/tests/test_fatturapa_xml_validation.py b/l10n_it_fatturapa_out_sp/tests/test_fatturapa_xml_validation.py new file mode 100644 index 00000000000..0c14e12c936 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/tests/test_fatturapa_xml_validation.py @@ -0,0 +1,90 @@ +# Copyright 2014 Davide Corio +# Copyright 2015-2016 Lorenzo Battistini - Agile Business Group +# Copyright 2018-2019 Alex Comba - Agile Business Group + +import base64 + +from odoo.tests import tagged + +from .fatturapa_common import FatturaPACommon + + +@tagged("post_install", "-at_install") +class TestFatturaPAXMLValidation(FatturaPACommon): + def setUp(self): + super(TestFatturaPAXMLValidation, self).setUp() + + # XXX - a company named "YourCompany" alread exists + # we move it out of the way but we should do better here + self.env.company.sudo().search([("name", "=", "YourCompany")]).write( + {"name": "YourCompany_"} + ) + + self.env.company.name = "YourCompany" + self.env.company.vat = "IT06363391001" + self.env.company.fatturapa_art73 = True + self.env.company.partner_id.street = "Via Milano, 1" + self.env.company.partner_id.city = "Roma" + self.env.company.partner_id.state_id = self.env.ref("base.state_us_2").id + self.env.company.partner_id.zip = "00100" + self.env.company.partner_id.phone = "06543534343" + self.env.company.email = "info@yourcompany.example.com" + self.env.company.partner_id.country_id = self.env.ref("base.it").id + self.env.company.fatturapa_fiscal_position_id = self.env.ref( + "l10n_it_fatturapa.fatturapa_RF01" + ).id + + self.env["decimal.precision"].search( + [("name", "=", "Product Unit of Measure")] + ).digits = 3 + self.env["uom.uom"].search([("name", "=", "Units")]).name = "Unit(s)" + + def test_4_xml_export(self): + invoice = self.invoice_model.create( + { + "name": "INV/2016/0016", + "invoice_date": "2016-06-15", + "partner_id": self.res_partner_fatturapa_0.id, + "journal_id": self.sales_journal.id, + "invoice_payment_term_id": self.account_payment_term.id, + "user_id": self.user_demo.id, + "move_type": "out_invoice", + "currency_id": self.EUR.id, + "fiscal_position_id": self.fiscal_position_sp.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "product_id": self.product_product_10.id, + "name": "Mouse, Optical", + "quantity": 1, + "product_uom_id": self.product_uom_unit.id, + "price_unit": 10, + "tax_ids": [(6, 0, {self.tax_22_SP.id})], + }, + ), + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "product_id": self.product_order_01.id, + "name": "Zed+ Antivirus", + "quantity": 1, + "product_uom_id": self.product_uom_unit.id, + "price_unit": 4, + "tax_ids": [(6, 0, {self.tax_22_SP.id})], + }, + ), + ], + } + ) + self.assertTrue(invoice.fiscal_document_type_id) + invoice._post() + res = self.run_wizard(invoice.id) + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00004.xml") + xml_content = base64.decodebytes(attachment.datas) + self.check_content(xml_content, "IT06363391001_00004.xml") diff --git a/l10n_it_fatturapa_out_sp/wizard/__init__.py b/l10n_it_fatturapa_out_sp/wizard/__init__.py new file mode 100644 index 00000000000..cf085ece47b --- /dev/null +++ b/l10n_it_fatturapa_out_sp/wizard/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2022 Marco Colombo + +from . import wizard_export_fatturapa diff --git a/l10n_it_fatturapa_out_sp/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_sp/wizard/wizard_export_fatturapa.py new file mode 100644 index 00000000000..be1e12e8af8 --- /dev/null +++ b/l10n_it_fatturapa_out_sp/wizard/wizard_export_fatturapa.py @@ -0,0 +1,15 @@ +# Copyright 2022 Marco Colombo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class WizardExportFatturapa(models.TransientModel): + _inherit = "wizard.export.fatturapa" + + @api.model + def getImportoTotale(self, invoice): + amount_total = super().getImportoTotale(invoice) + if invoice.split_payment: + amount_total += invoice.amount_sp + return amount_total diff --git a/setup/l10n_it_fatturapa_out_sp/odoo/addons/l10n_it_fatturapa_out_sp b/setup/l10n_it_fatturapa_out_sp/odoo/addons/l10n_it_fatturapa_out_sp new file mode 120000 index 00000000000..ac3aa24705f --- /dev/null +++ b/setup/l10n_it_fatturapa_out_sp/odoo/addons/l10n_it_fatturapa_out_sp @@ -0,0 +1 @@ +../../../../l10n_it_fatturapa_out_sp \ No newline at end of file diff --git a/setup/l10n_it_fatturapa_out_sp/setup.py b/setup/l10n_it_fatturapa_out_sp/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/l10n_it_fatturapa_out_sp/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)