From 9ffd56f36fc256e0bd10e761681de411c5703f0a Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 30 Apr 2023 01:21:43 +0200 Subject: [PATCH] [FIX] l10n_es_aeat_sii_oca: Change registration key on FP change Steps to reproduce: - Have partner 1 with fiscal position FP1 with registration key 01. - Have partner 2 with fiscal position FP2 with registration key 02. - Create customer invoice with partner 1 as customer. - Select partner 2 as delivery address. Expected result: Fiscal position is changed to FP2 and the registration key is changed to 02. Current behavior: The fiscal position is changed, but not the registration key. That's because the recursive onchanges are explicitly disabled in account move object: https://github.com/odoo/odoo/blob/2f817a7b36cc7e5ab235829eecd61a1d71ce546e/addons/account/models/account_move.py#L1190 We workaround this limitation converting the registration key into a computed writable field that is computed even if the recursive onchange is disabled. --- l10n_es_aeat_sii_oss/__manifest__.py | 2 +- l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/l10n_es_aeat_sii_oss/__manifest__.py b/l10n_es_aeat_sii_oss/__manifest__.py index 4f0cf90dfd4..09745c8949c 100644 --- a/l10n_es_aeat_sii_oss/__manifest__.py +++ b/l10n_es_aeat_sii_oss/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Suministro Inmediato de InformaciĆ³n en el IVA: OSS", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "category": "Accounting & Finance", "website": "https://github.com/OCA/l10n-spain", "author": "FactorLibre, Tecnativa, Odoo Community Association (OCA)", diff --git a/l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py b/l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py index 4df302f2519..04ccd9ac3ae 100644 --- a/l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py +++ b/l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py @@ -51,4 +51,3 @@ def test_invoice_sii_oss(self): res = invoice._get_sii_invoice_dict() res_issue = res["FacturaExpedida"] self.assertEqual(res_issue["ImporteTotal"], 100) - self.assertEqual(res_issue["ClaveRegimenEspecialOTrascendencia"], "17")