Skip to content

Commit

Permalink
[FIX] l10n_es_aeat_sii_oca: Change registration key on FP change
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pedrobaeza authored and Javier Iniesta committed Jun 20, 2023
1 parent 9b5c176 commit 9ffd56f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion l10n_es_aeat_sii_oss/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
1 change: 0 additions & 1 deletion l10n_es_aeat_sii_oss/tests/test_l10n_es_aeat_sii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 9ffd56f

Please sign in to comment.