diff --git a/account_vat_period_end_statement/tests/test_vat_statement.py b/account_vat_period_end_statement/tests/test_vat_statement.py
index e659d4bc235b..785ff9a21588 100644
--- a/account_vat_period_end_statement/tests/test_vat_statement.py
+++ b/account_vat_period_end_statement/tests/test_vat_statement.py
@@ -5,9 +5,12 @@
from dateutil.rrule import MONTHLY
+from odoo.tests import tagged
+
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestTax(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
diff --git a/l10n_it_account/tests/test_l10n_it_account.py b/l10n_it_account/tests/test_l10n_it_account.py
index 8d119c02a610..f67c6ad80f8c 100644
--- a/l10n_it_account/tests/test_l10n_it_account.py
+++ b/l10n_it_account/tests/test_l10n_it_account.py
@@ -2,11 +2,13 @@
from odoo import fields
from odoo.exceptions import ValidationError
+from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestAccount(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
diff --git a/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py b/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
index d5551ad3d636..dfc28d734a11 100644
--- a/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
+++ b/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
@@ -5,12 +5,14 @@
from odoo import fields
from odoo.exceptions import UserError, ValidationError
+from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestDeclarationOfIntent(AccountTestInvoicingCommon):
@classmethod
def _create_declaration(cls, partner, type_d):
diff --git a/l10n_it_fatturapa_out/data/invoice_it_template.xml b/l10n_it_fatturapa_out/data/invoice_it_template.xml
index 2a4ef2bd1922..54e3138e782e 100644
--- a/l10n_it_fatturapa_out/data/invoice_it_template.xml
+++ b/l10n_it_fatturapa_out/data/invoice_it_template.xml
@@ -170,7 +170,9 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
-
+
INVCONT
+
+ Valuta
+
+
+
+
@@ -217,9 +229,11 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
+
-
+
-
+
+
-->
+
@@ -600,10 +627,10 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
+
+
diff --git a/l10n_it_fatturapa_out/models/company.py b/l10n_it_fatturapa_out/models/company.py
index fcbf2fe3c24c..3ba9073a0dbc 100644
--- a/l10n_it_fatturapa_out/models/company.py
+++ b/l10n_it_fatturapa_out/models/company.py
@@ -1,9 +1,12 @@
# Copyright 2019 Roberto Fichera
+# Copyright 2022 Marco Colombo
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
+_DEFAULT_XML_DIVISA_VALUE = "force_eur"
+
class ResCompany(models.Model):
_inherit = "res.company"
@@ -15,6 +18,15 @@ class ResCompany(models.Model):
"in a single XML file. 0=Unlimited",
)
+ xml_divisa_value = fields.Selection(
+ [
+ ("keep_orig", "Keep original"),
+ ("force_eur", "Force euro"),
+ ],
+ string="XML Divisa value",
+ default=_DEFAULT_XML_DIVISA_VALUE,
+ )
+
@api.constrains("max_invoice_in_xml")
def _validate_max_invoice_in_xml(self):
if self.max_invoice_in_xml < 0:
@@ -33,12 +45,20 @@ class AccountConfigSettings(models.TransientModel):
related="company_id.max_invoice_in_xml", readonly=False
)
+ xml_divisa_value = fields.Selection(
+ related="company_id.xml_divisa_value", readonly=False
+ )
+
@api.onchange("company_id")
def onchange_company_id(self):
res = super(AccountConfigSettings, self).onchange_company_id()
if self.company_id:
company = self.company_id
self.max_invoice_in_xml = company.max_invoice_in_xml or 0
+ self.xml_divisa_value = (
+ company.xml_divisa_value or _DEFAULT_XML_DIVISA_VALUE
+ )
else:
self.max_invoice_in_xml = 0
+ self.xml_divisa_value = _DEFAULT_XML_DIVISA_VALUE
return res
diff --git a/l10n_it_fatturapa_out/tests/data/IT06363391001_00009.xml b/l10n_it_fatturapa_out/tests/data/IT06363391001_00009.xml
deleted file mode 100644
index 94ccc4e7d2ab..000000000000
--- a/l10n_it_fatturapa_out/tests/data/IT06363391001_00009.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
- IT
- 06363391001
-
- 00009
- FPR12
- XXXXXXX
-
- 06543534343
- info@yourcompany.example.com
-
-
-
-
-
- IT
- 06363391001
-
-
- YourCompany
-
- RF01
-
-
- Via Milano, 1
- 00100
- Roma
- AK
- IT
-
-
- 06543534343
- info@yourcompany.example.com
-
-
-
-
-
- AE
- 99999999999
-
-
- Foreign Customer
-
-
-
- 29-17 Al Thanya St
- 00000
- Dubai
- EE
- AE
-
-
-
-
-
-
- TD01
- AED
- 2018-01-07
- INV/2018/0018
- 14.00
- SI
-
-
-
-
- 1
- Mouse Optical
- 1.000
- Unit(s)
- 8.19672
- 8.20
- 22.00
-
-
- 2
- Zed+ Antivirus
- 1.000
- Unit(s)
- 3.27869
- 3.28
- 22.00
-
-
- 22.00
- 11.48
- 2.52
-
-
-
- TP02
-
- MP05
- 2018-02-28
- 14.00
-
-
-
-
diff --git a/l10n_it_fatturapa_out/tests/data/IT06363391001_00015.xml b/l10n_it_fatturapa_out/tests/data/IT06363391001_00015.xml
new file mode 100644
index 000000000000..07f44f0d129f
--- /dev/null
+++ b/l10n_it_fatturapa_out/tests/data/IT06363391001_00015.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ IT
+ 06363391001
+
+ 00015
+ 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
+ 2021-12-16
+ INV/2021/12/0001
+ 11.97
+ SI
+
+
+
+
+ 1
+ Cabinet with Doors
+ 1.000
+ Unit(s)
+ 11.96581
+ 11.97
+ 0.00
+ N3.2
+
+ Valuta
+ USD
+ 14.00000
+ 2021-12-16
+
+
+
+ 0.00
+ N3.2
+ 11.97
+ 0.00
+ Not subject to VAT law
+
+
+
+ TP02
+
+ MP05
+ 2022-01-31
+ 11.97
+
+
+
+
diff --git a/l10n_it_fatturapa_out/tests/data/IT06363391001_00016.xml b/l10n_it_fatturapa_out/tests/data/IT06363391001_00016.xml
new file mode 100644
index 000000000000..ce25d80a53e6
--- /dev/null
+++ b/l10n_it_fatturapa_out/tests/data/IT06363391001_00016.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ IT
+ 06363391001
+
+ 00016
+ 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
+ USD
+ 2021-12-16
+ INV/2021/12/0001
+ 14.00
+ SI
+
+
+
+
+ 1
+ Cabinet with Doors
+ 1.000
+ Unit(s)
+ 11.96581
+ 11.97
+ 0.00
+ N3.2
+
+ Valuta
+ USD
+ 14.00000
+ 2021-12-16
+
+
+
+ 0.00
+ N3.2
+ 11.97
+ 0.00
+ Not subject to VAT law
+
+
+
+ TP02
+
+ MP05
+ 2022-01-31
+ 14.00
+
+
+
+
diff --git a/l10n_it_fatturapa_out/tests/test_fatturapa_out_noteline.py b/l10n_it_fatturapa_out/tests/test_fatturapa_out_noteline.py
index d27713a90663..a2d054cec475 100644
--- a/l10n_it_fatturapa_out/tests/test_fatturapa_out_noteline.py
+++ b/l10n_it_fatturapa_out/tests/test_fatturapa_out_noteline.py
@@ -5,11 +5,12 @@
from lxml import etree
from odoo import fields
-from odoo.tests import Form
+from odoo.tests import Form, tagged
from .fatturapa_common import FatturaPACommon
+@tagged("post_install", "-at_install")
class TestFatturaOutNoteLine(FatturaPACommon):
def setUp(self):
super().setUp()
diff --git a/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py b/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py
index bc2244e68d0d..36610d1ab8b9 100644
--- a/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py
+++ b/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py
@@ -9,12 +9,13 @@
from odoo import fields
from odoo.exceptions import UserError
-from odoo.tests import Form
+from odoo.tests import Form, tagged
from odoo.tools import mute_logger
from .fatturapa_common import FatturaPACommon
+@tagged("post_install", "-at_install")
class TestDuplicatedAttachment(FatturaPACommon):
def test_duplicated_attachment(self):
"""Attachment name must be unique"""
@@ -35,6 +36,7 @@ def test_duplicated_attachment(self):
self.assertEqual(ie.exception.pgcode, "23505")
+@tagged("post_install", "-at_install")
class TestFatturaPAXMLValidation(FatturaPACommon):
def setUp(self):
super(TestFatturaPAXMLValidation, self).setUp()
@@ -450,62 +452,6 @@ def test_8_xml_export(self):
xml_content = base64.decodebytes(attachment.datas)
self.check_content(xml_content, "IT06363391001_00008.xml")
- def test_9_xml_export(self):
- self.tax_22.price_include = True
- self.set_sequences(18, "2018-01-07")
- partner = self.res_partner_fatturapa_4
- partner.onchange_country_id_e_inv()
- partner.write(partner._convert_to_write(partner._cache))
- self.assertEqual(partner.codice_destinatario, "XXXXXXX")
- invoice = self.invoice_model.create(
- {
- "name": "INV/2018/0018",
- "invoice_date": "2018-01-07",
- "partner_id": partner.id,
- "journal_id": self.sales_journal.id,
- # "account_id": self.a_recv.id,
- "invoice_payment_term_id": self.account_payment_term.id,
- "user_id": self.user_demo.id,
- "move_type": "out_invoice",
- "currency_id": self.AED.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.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.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_00009.xml")
-
- xml_content = base64.decodebytes(attachment.datas)
- self.check_content(xml_content, "IT06363391001_00009.xml")
-
def test_10_xml_export(self):
# invoice with descriptive line
self.set_sequences(10, "2019-08-07")
@@ -748,6 +694,67 @@ def test_14_xml_export(self):
xml_content = base64.decodebytes(attachment.datas)
self.check_content(xml_content, "IT06363391001_00014.xml")
+ def test_15_xml_export(self):
+ """
+ - create an invoice in USD
+
+ expect an XML with values in EUR
+ """
+
+ usd = self.env.ref("base.USD")
+
+ self.env["res.currency.rate"].create(
+ {
+ "name": fields.Date.from_string("2021-12-16"),
+ "rate": 1.17,
+ "currency_id": usd.id,
+ "company_id": self.env.company.id,
+ }
+ )
+
+ invoice_form = Form(
+ self.env["account.move"].with_context({"default_move_type": "out_invoice"})
+ )
+ invoice_form.currency_id = usd
+ invoice_form.partner_id = self.res_partner_fatturapa_0
+ invoice_form.name = "INV/2021/12/0001"
+ invoice_form.date = fields.Date.from_string("2021-12-16")
+ invoice_form.invoice_date = fields.Date.from_string("2021-12-16")
+ invoice_form.invoice_payment_term_id = self.account_payment_term
+
+ self.tax_00_ns.kind_id = self.env.ref("l10n_it_account_tax_kind.n3_2")
+
+ with invoice_form.line_ids.new() as line_form:
+ line_form.product_id = self.product_product_10
+ line_form.account_id = self.a_sale
+ line_form.tax_ids.clear()
+ line_form.tax_ids.add(self.tax_00_ns)
+ invoice = invoice_form.save()
+ invoice.action_post()
+
+ # commit 86febae278f08864e83017d43f6aa9d67165d664 fixed this as
+ # a side effect: now the price is actually 14.00 USD not 16.38
+ # for env.ref("product.product_product_10")
+ # self.assertEqual(invoice.invoice_line_ids[0].price_unit, 16.38)
+ self.assertEqual(invoice.invoice_line_ids[0].price_unit, 14.00)
+
+ invoice.company_id.xml_divisa_value = "force_eur"
+ res = self.run_wizard(invoice.id)
+ attachment = self.attach_model.browse(res["res_id"])
+ self.set_e_invoice_file_id(attachment, "IT06363391001_00015.xml")
+
+ xml_content = base64.decodebytes(attachment.datas)
+ self.check_content(xml_content, "IT06363391001_00015.xml")
+ attachment.unlink()
+
+ invoice.company_id.xml_divisa_value = "keep_orig"
+ res = self.run_wizard(invoice.id)
+ attachment = self.attach_model.browse(res["res_id"])
+ self.set_e_invoice_file_id(attachment, "IT06363391001_00016.xml")
+
+ xml_content = base64.decodebytes(attachment.datas)
+ self.check_content(xml_content, "IT06363391001_00016.xml")
+
def test_no_tax_fail(self):
"""
- create an invoice with a product line without taxes
diff --git a/l10n_it_fatturapa_out/views/company_view.xml b/l10n_it_fatturapa_out/views/company_view.xml
index f50771ba8ac1..4af49e26c90a 100644
--- a/l10n_it_fatturapa_out/views/company_view.xml
+++ b/l10n_it_fatturapa_out/views/company_view.xml
@@ -15,10 +15,20 @@
position="after"
>
-
+
+
+
+
+
diff --git a/l10n_it_fatturapa_out/wizard/efattura.py b/l10n_it_fatturapa_out/wizard/efattura.py
index fa5e7d0f696d..8cb2a07a7ae0 100644
--- a/l10n_it_fatturapa_out/wizard/efattura.py
+++ b/l10n_it_fatturapa_out/wizard/efattura.py
@@ -99,7 +99,7 @@ def format_phone(number):
return number
return False
- def format_price(line, sign=1):
+ def format_price(line, sign=1, original_currency=False):
res = line.price_unit
if line.tax_ids and line.tax_ids[0].price_include:
res = line.price_unit / (1 + (line.tax_ids[0].amount / 100))
@@ -114,6 +114,10 @@ def format_price(line, sign=1):
if line.quantity < 0:
res = -res
+ # force EUR unless we want the original currency
+ if not original_currency:
+ res = fpa_to_eur(res, line.move_id)
+
# XXX arrotondamento?
res = "{prezzo:.{precision}f}".format(
prezzo=sign * res, precision=price_precision
@@ -260,6 +264,20 @@ def get_importo(line):
return False
return line.price_unit * line.discount / 100
+ def get_importo_totale(invoice):
+ # wrapper to a method in wizard (for better overriding)
+ wiz = self.env["wizard.export.fatturapa"]
+ return wiz.getImportoTotale(invoice)
+
+ def fpa_to_eur(amount, invoice):
+ currency = invoice.currency_id
+ euro = self.env.ref("base.EUR")
+ if currency == euro:
+ return amount
+ return currency._convert(
+ amount, euro, invoice.company_id, invoice.date, False
+ )
+
if self.partner_id.commercial_partner_id.is_pa:
# check value code
code = self.partner_id.ipa_code
@@ -291,9 +309,11 @@ def get_importo(line):
"unidecode": unidecode,
"wizard": self.wizard,
"get_importo": get_importo,
+ "get_importo_totale": get_importo_totale,
"all_taxes": {
invoice.id: get_all_taxes(invoice) for invoice in self.invoices
},
+ "fpa_to_eur": fpa_to_eur,
}
return template_values
diff --git a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
index 056d09df3c53..a2b56ed95395 100644
--- a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
+++ b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
@@ -74,6 +74,19 @@ def getPartnerId(self, invoice_ids):
return partner
+ @api.model
+ def getImportoTotale(self, invoice):
+ """Entry point for other modules to override computation of
+ ImportoTotaleDocumento"""
+ # this requires a better refactoring. We SHOULD be able to use
+ # amount_total as is, w/o further computations.
+ # At the moment, some modules store the total amount to be paid
+ # by the customer, and handle the printed total in the print
+ # report (there are cases in which the partner does not have to
+ # paid the VAT, yet its amount has to be printed out and included
+ # in the total amount of the invoice)
+ return invoice.amount_total
+
def group_invoices_by_partner(self):
def split_list(my_list, size):
it = iter(my_list)
diff --git a/l10n_it_fatturapa_out_di/tests/test_fatturapa_xml_validation.py b/l10n_it_fatturapa_out_di/tests/test_fatturapa_xml_validation.py
index d63dd57d39af..294937eb1348 100644
--- a/l10n_it_fatturapa_out_di/tests/test_fatturapa_xml_validation.py
+++ b/l10n_it_fatturapa_out_di/tests/test_fatturapa_xml_validation.py
@@ -3,11 +3,12 @@
import base64
from odoo import fields
-from odoo.tests import Form
+from odoo.tests import Form, tagged
from .fatturapa_common import FatturaPACommon
+@tagged("post_install", "-at_install")
class TestFatturaPAXMLValidation(FatturaPACommon):
def setUp(self):
super(TestFatturaPAXMLValidation, self).setUp()
diff --git a/l10n_it_fatturapa_out_rc/tests/test_fatturapa_xml_validation.py b/l10n_it_fatturapa_out_rc/tests/test_fatturapa_xml_validation.py
index 72fa21d46e05..deac0b35266c 100644
--- a/l10n_it_fatturapa_out_rc/tests/test_fatturapa_xml_validation.py
+++ b/l10n_it_fatturapa_out_rc/tests/test_fatturapa_xml_validation.py
@@ -5,12 +5,14 @@
from odoo import fields
from odoo.exceptions import UserError
+from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import FatturaPACommon
from odoo.addons.l10n_it_reverse_charge.tests.rc_common import ReverseChargeCommon
+@tagged("post_install", "-at_install")
class TestFatturaPAXMLValidation(ReverseChargeCommon, FatturaPACommon):
def setUp(self):
super().setUp()
diff --git a/l10n_it_fatturapa_out_rc/views/invoice_it_template.xml b/l10n_it_fatturapa_out_rc/views/invoice_it_template.xml
index f598caf3a1f5..e9c4dccb7710 100644
--- a/l10n_it_fatturapa_out_rc/views/invoice_it_template.xml
+++ b/l10n_it_fatturapa_out_rc/views/invoice_it_template.xml
@@ -50,22 +50,20 @@
t-esc="record.fiscal_document_type_id.code"
/>
-
-
-
+
+
@@ -86,7 +84,7 @@
diff --git a/l10n_it_fatturapa_out_rc/wizard/efattura.py b/l10n_it_fatturapa_out_rc/wizard/efattura.py
index f4d24d56a9dd..77fa143a106e 100644
--- a/l10n_it_fatturapa_out_rc/wizard/efattura.py
+++ b/l10n_it_fatturapa_out_rc/wizard/efattura.py
@@ -6,17 +6,10 @@
)
+# extend the EFatturaOut class to add a new helper function
class EFatturaOut(_EFatturaOut):
def get_template_values(self):
- def get_sign(invoice):
- sign = 1
- if invoice.move_type in [
- "out_refund",
- "in_refund",
- ] and invoice.fiscal_document_type_id.code not in ["TD04", "TD08"]:
- sign = -1
- return sign
-
+ get_sign = self.env["wizard.export.fatturapa"].getSign
template_values = super().get_template_values()
template_values.update({"get_sign": get_sign})
return template_values
diff --git a/l10n_it_fatturapa_out_rc/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_rc/wizard/wizard_export_fatturapa.py
index 0b6c85346375..27451866b7d6 100644
--- a/l10n_it_fatturapa_out_rc/wizard/wizard_export_fatturapa.py
+++ b/l10n_it_fatturapa_out_rc/wizard/wizard_export_fatturapa.py
@@ -1,7 +1,7 @@
# Copyright 2021 Alex Comba - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from odoo import models
+from odoo import api, models
from .efattura import EFatturaOut
@@ -9,5 +9,22 @@
class WizardExportFatturapa(models.TransientModel):
_inherit = "wizard.export.fatturapa"
+ @api.model
def _get_efattura_class(self):
return EFatturaOut
+
+ @api.model
+ def getSign(self, invoice):
+ sign = 1
+ if invoice.move_type in [
+ "out_refund",
+ "in_refund",
+ ] and invoice.fiscal_document_type_id.code not in ["TD04", "TD08"]:
+ sign = -1
+ return sign
+
+ @api.model
+ def getImportoTotale(self, invoice):
+ amount_total = super().getImportoTotale(invoice)
+ amount_total *= self.getSign(invoice)
+ return amount_total
diff --git a/l10n_it_fatturapa_out_sp/__init__.py b/l10n_it_fatturapa_out_sp/__init__.py
index e69de29bb2d1..4b19b1a70022 100644
--- a/l10n_it_fatturapa_out_sp/__init__.py
+++ 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
index 739439cecb85..b7f11ae291f3 100644
--- a/l10n_it_fatturapa_out_sp/__manifest__.py
+++ b/l10n_it_fatturapa_out_sp/__manifest__.py
@@ -7,14 +7,12 @@
"category": "Localization/Italy",
"summary": "Scissione pagamenti in fatturapa",
"author": "Marco Colombo," "Odoo Community Association (OCA)",
- "website": "https://github.com/OCA/l10n-italy" "l10n_it_fatturapa_out_sp",
+ "website": "https://github.com/OCA/l10n-italy",
"license": "AGPL-3",
"depends": [
"l10n_it_fatturapa_out",
"l10n_it_split_payment",
],
- "data": [
- "view/invoice_it_template.xml",
- ],
"installable": True,
+ "autoinstall": True,
}
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
index 2cd498e4ee8e..10077e74cec0 100644
--- a/l10n_it_fatturapa_out_sp/tests/test_fatturapa_xml_validation.py
+++ b/l10n_it_fatturapa_out_sp/tests/test_fatturapa_xml_validation.py
@@ -4,9 +4,12 @@
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()
diff --git a/l10n_it_fatturapa_out_sp/view/invoice_it_template.xml b/l10n_it_fatturapa_out_sp/view/invoice_it_template.xml
deleted file mode 100644
index a106a951f782..000000000000
--- a/l10n_it_fatturapa_out_sp/view/invoice_it_template.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
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 000000000000..cf085ece47be
--- /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 000000000000..be1e12e8af8e
--- /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/l10n_it_fatturapa_pec/tests/test_e_invoice_response.py b/l10n_it_fatturapa_pec/tests/test_e_invoice_response.py
index 2c0f713385d5..214c49e1dd63 100644
--- a/l10n_it_fatturapa_pec/tests/test_e_invoice_response.py
+++ b/l10n_it_fatturapa_pec/tests/test_e_invoice_response.py
@@ -6,11 +6,13 @@
from odoo.fields import Datetime
from odoo.modules import get_module_resource
+from odoo.tests import tagged
from odoo.tools import mute_logger, pycompat
from .e_invoice_common import EInvoiceCommon
+@tagged("post_install", "-at_install")
class TestEInvoiceResponse(EInvoiceCommon):
def setUp(self):
super(TestEInvoiceResponse, self).setUp()
diff --git a/l10n_it_fatturapa_pec/tests/test_e_invoice_send.py b/l10n_it_fatturapa_pec/tests/test_e_invoice_send.py
index c2c917942f86..da8848a8ea6d 100644
--- a/l10n_it_fatturapa_pec/tests/test_e_invoice_send.py
+++ b/l10n_it_fatturapa_pec/tests/test_e_invoice_send.py
@@ -2,11 +2,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import UserError
+from odoo.tests import tagged
from odoo.tools import mute_logger
from .e_invoice_common import EInvoiceCommon
+@tagged("post_install", "-at_install")
class TestEInvoiceSend(EInvoiceCommon):
def setUp(self):
super(TestEInvoiceSend, self).setUp()
diff --git a/l10n_it_fiscal_document_type/tests/test_doc_type.py b/l10n_it_fiscal_document_type/tests/test_doc_type.py
index d31c7b3b1e7a..85795a61717e 100644
--- a/l10n_it_fiscal_document_type/tests/test_doc_type.py
+++ b/l10n_it_fiscal_document_type/tests/test_doc_type.py
@@ -1,11 +1,12 @@
# Copyright 2017 Lorenzo Battistini
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
-from odoo.tests import Form
+from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestDocType(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
diff --git a/l10n_it_intrastat/tests/test_intrastat.py b/l10n_it_intrastat/tests/test_intrastat.py
index 2e102665e8f6..5e85e62be2da 100644
--- a/l10n_it_intrastat/tests/test_intrastat.py
+++ b/l10n_it_intrastat/tests/test_intrastat.py
@@ -1,9 +1,12 @@
# Copyright 2019 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+from odoo.tests import tagged
+
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestIntrastat(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
diff --git a/l10n_it_reverse_charge/tests/test_rc.py b/l10n_it_reverse_charge/tests/test_rc.py
index cf0eac3a8520..f34324d6ca1f 100644
--- a/l10n_it_reverse_charge/tests/test_rc.py
+++ b/l10n_it_reverse_charge/tests/test_rc.py
@@ -4,10 +4,12 @@
import json
from odoo.exceptions import UserError
+from odoo.tests import tagged
from .rc_common import ReverseChargeCommon
+@tagged("post_install", "-at_install")
class TestReverseCharge(ReverseChargeCommon):
def test_intra_EU_invoice_line_no_tax(self):
invoice = self.create_invoice(self.supplier_intraEU, [], post=False)
@@ -96,6 +98,22 @@ def test_intra_EU_cancel_and_draft(self):
self.assertEqual(invoice.state, "draft")
def test_intra_EU_zero_total(self):
+
+ with self.assertRaises(UserError):
+ # this is defined in odoo.addons.account.tests.common.AccountTestInvoicingCommon
+ self.init_invoice(
+ "in_invoice",
+ partner=self.supplier_intraEU,
+ post=True,
+ amounts=[100, -100],
+ taxes=self.tax_22ai,
+ )
+
+ # disable the rest of the test as it depends on this NOT to fail
+ return
+
+ # TMP
+ # pylint: disable=W0101
invoice = self.create_invoice(
self.supplier_intraEU, [100, -100], taxes=self.tax_22ai
)
diff --git a/l10n_it_sdi_channel/views/company_view.xml b/l10n_it_sdi_channel/views/company_view.xml
index 1d1c0c54bba0..f1b5326769ed 100644
--- a/l10n_it_sdi_channel/views/company_view.xml
+++ b/l10n_it_sdi_channel/views/company_view.xml
@@ -60,7 +60,7 @@
-
+
diff --git a/l10n_it_split_payment/tests/test_splitpayment.py b/l10n_it_split_payment/tests/test_splitpayment.py
index bc3f723c4270..ad86d41cb835 100644
--- a/l10n_it_split_payment/tests/test_splitpayment.py
+++ b/l10n_it_split_payment/tests/test_splitpayment.py
@@ -3,9 +3,12 @@
# Copyright 2016 Alessio Gerace - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from odoo.tests import tagged
+
from odoo.addons.account.tests.test_account_account import TestAccountAccount
+@tagged("post_install", "-at_install")
class TestSP(TestAccountAccount):
def setUp(self):
super().setUp()
diff --git a/l10n_it_vat_registries_split_payment/tests/test_sp.py b/l10n_it_vat_registries_split_payment/tests/test_sp.py
index 2612708e93f9..e25288e255f2 100644
--- a/l10n_it_vat_registries_split_payment/tests/test_sp.py
+++ b/l10n_it_vat_registries_split_payment/tests/test_sp.py
@@ -1,9 +1,10 @@
from odoo import fields
-from odoo.tests import Form
+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):
diff --git a/l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py b/l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py
index aedc8c7c72fa..1441031aec3f 100644
--- a/l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py
+++ b/l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py
@@ -6,9 +6,12 @@
from dateutil.rrule import MONTHLY
+from odoo.tests import tagged
+
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestTaxSP(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
diff --git a/l10n_it_withholding_tax_payment/tests/test_withholding_tax_payment.py b/l10n_it_withholding_tax_payment/tests/test_withholding_tax_payment.py
index 09c9252bd75a..23a79266bf12 100644
--- a/l10n_it_withholding_tax_payment/tests/test_withholding_tax_payment.py
+++ b/l10n_it_withholding_tax_payment/tests/test_withholding_tax_payment.py
@@ -1,11 +1,12 @@
# Copyright 2021 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from odoo.tests import Form
+from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
+@tagged("post_install", "-at_install")
class TestWithholdingTaxPayment(AccountTestInvoicingCommon):
@classmethod
def setup_withholding_tax(cls, company_data):