diff --git a/l10n_it_fatturapa_out_fd/README.rst b/l10n_it_fatturapa_out_fd/README.rst index 18bfd2045dc0..a12cf5f13293 100644 --- a/l10n_it_fatturapa_out_fd/README.rst +++ b/l10n_it_fatturapa_out_fd/README.rst @@ -17,13 +17,13 @@ ITA - Fattura elettronica - Emissione - Sconto fisso :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_out_fd + :target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_out_fd :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_out_fd + :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_out_fd :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=12.0 + :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| @@ -47,7 +47,7 @@ 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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,6 +79,6 @@ 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. +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_fd/__manifest__.py b/l10n_it_fatturapa_out_fd/__manifest__.py index d362ff58de4e..08e627e881fa 100644 --- a/l10n_it_fatturapa_out_fd/__manifest__.py +++ b/l10n_it_fatturapa_out_fd/__manifest__.py @@ -2,12 +2,11 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "ITA - Fattura elettronica - Emissione - Sconto fisso", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "category": "Localization/Italy", "summary": "Emissione di fattura elettronica con sconto fisso", "author": "TAKOBI, Odoo Community Association (OCA)", - "website": "https://github.com/OCA/l10n-italy" - "/tree/12.0/l10n_it_fatturapa_out_fd", + "website": "https://github.com/OCA/l10n-italy", "license": "AGPL-3", "depends": [ "l10n_it_fatturapa_out", diff --git a/l10n_it_fatturapa_out_fd/static/description/index.html b/l10n_it_fatturapa_out_fd/static/description/index.html index 505f171cba68..c68f1b49b42f 100644 --- a/l10n_it_fatturapa_out_fd/static/description/index.html +++ b/l10n_it_fatturapa_out_fd/static/description/index.html @@ -368,7 +368,7 @@

ITA - Fattura elettronica - Emissione - Sconto fisso

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:7fec8e7baf6822cef32b57f070a3692bc15eaebb8df93ab1f7b212799c0bd350 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

Italiano

Modulo tecnico di integrazione tra account_invoice_fixed_discount e l10n_it_fatturapa_out.

English

@@ -390,7 +390,7 @@

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -417,7 +417,7 @@

Maintainers

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.

+

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_fd/tests/data/IT06363391001_00001.xml b/l10n_it_fatturapa_out_fd/tests/data/IT06363391001_00001.xml index 03e73cb62f3b..6ed6548b6dad 100644 --- a/l10n_it_fatturapa_out_fd/tests/data/IT06363391001_00001.xml +++ b/l10n_it_fatturapa_out_fd/tests/data/IT06363391001_00001.xml @@ -1,4 +1,7 @@ - + diff --git a/l10n_it_fatturapa_out_fd/tests/test_xml_generation.py b/l10n_it_fatturapa_out_fd/tests/test_xml_generation.py index f37c674b2f8f..399cc7b48013 100644 --- a/l10n_it_fatturapa_out_fd/tests/test_xml_generation.py +++ b/l10n_it_fatturapa_out_fd/tests/test_xml_generation.py @@ -3,25 +3,26 @@ import base64 -from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import (FatturaPACommon) -from odoo.tests import Form +from odoo.tests import Form, tagged +from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import FatturaPACommon -class TestXMLGeneration (FatturaPACommon): +@tagged("post_install", "-at_install") +class TestXMLGeneration(FatturaPACommon): def test_fixed_discount(self): """Generate an e-invoice for an invoice having a fixed discount. Check that the ScontoMaggiorazione is present in the generated e-invoice. """ # Setup for fixing date and sequence of new invoices - date_invoice = '2020-01-01' + date_invoice = "2020-01-01" self.set_sequences(1, date_invoice) # Arrange: Create an invoice with one line costing 100 # and fixed discount of 20 - invoice_form = Form(self.env['account.invoice']) + invoice_form = Form(self.env["account.move"]) invoice_form.partner_id = self.res_partner_fatturapa_2 - invoice_form.date_invoice = date_invoice + invoice_form.invoice_date = date_invoice with invoice_form.invoice_line_ids.new() as line: line.name = "Test fixed discount" line.price_unit = 1000 @@ -29,7 +30,7 @@ def test_fixed_discount(self): line.invoice_line_tax_ids.clear() line.invoice_line_tax_ids.add(self.tax_22) invoice = invoice_form.save() - invoice.action_invoice_open() + invoice._post() # pre-condition: Check invoice totals self.assertEqual(invoice.amount_untaxed, 980) self.assertEqual(invoice.amount_tax, 215.6) @@ -37,14 +38,14 @@ def test_fixed_discount(self): # Act: Generate the e-invoice action = self.run_wizard(invoice.id) - e_invoice = self.env[action['res_model']].browse(action['res_id']) + e_invoice = self.env[action["res_model"]].browse(action["res_id"]) # Assert: The E-invoice matches the XML in tests data - file_name = 'IT06363391001_00001.xml' + file_name = "IT06363391001_00001.xml" self.set_e_invoice_file_id(e_invoice, file_name) xml_content = base64.decodebytes(e_invoice.datas) self.check_content( xml_content, file_name, - module_name='l10n_it_fatturapa_out_fd', + module_name="l10n_it_fatturapa_out_fd", ) diff --git a/l10n_it_fatturapa_out_fd/wizards/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_fd/wizards/wizard_export_fatturapa.py index 0324cd927bfe..1479df43b948 100644 --- a/l10n_it_fatturapa_out_fd/wizards/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_fd/wizards/wizard_export_fatturapa.py @@ -1,25 +1,25 @@ # Copyright 2023 Simone Rubino - TAKOBI # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import models -from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( - ScontoMaggiorazioneType, - TipoScontoMaggiorazioneType, -) -from odoo.tools import float_round +from odoo import api, models -class WizardExportFatturapa (models.TransientModel): +class WizardExportFatturapa(models.TransientModel): _inherit = "wizard.export.fatturapa" - def setScontoMaggiorazione(self, line): - res = super().setScontoMaggiorazione(line) + @staticmethod + def get_importo(line): discount_fixed = line.discount_fixed if discount_fixed: - res.append( - ScontoMaggiorazioneType( - Tipo=TipoScontoMaggiorazioneType.SC, - Importo='%.2f' % float_round(discount_fixed, 8), - ) - ) - return res + return discount_fixed + str_number = str(line.discount) + number = str_number[::-1].find(".") + if number <= 2: + return False + return line.price_unit * line.discount / 100 + + @api.model + def getTemplateValues(self, template_values): + template_values = super().getTemplateValues(template_values) + template_values.update({"get_importo": self.get_importo}) + return template_values diff --git a/setup/l10n_it_fatturapa_out_fd/odoo/addons/l10n_it_fatturapa_out_fd b/setup/l10n_it_fatturapa_out_fd/odoo/addons/l10n_it_fatturapa_out_fd new file mode 120000 index 000000000000..2298f2a47c34 --- /dev/null +++ b/setup/l10n_it_fatturapa_out_fd/odoo/addons/l10n_it_fatturapa_out_fd @@ -0,0 +1 @@ +../../../../l10n_it_fatturapa_out_fd \ No newline at end of file diff --git a/setup/l10n_it_fatturapa_out_fd/setup.py b/setup/l10n_it_fatturapa_out_fd/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_fatturapa_out_fd/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)