Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] l10n_it_fatturapa_out: use parent codice_destinatario if not set in partner #4436

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from

Conversation

toita86
Copy link

@toita86 toita86 commented Nov 6, 2024

Se il campo use_parent_codice_destinatario è abilitato ogni child userà il suo codice_destinatario del proprio parent. Tiene conto del campo electronic_invoice_use_this_address.

@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch 3 times, most recently from d7b6c4e to d589651 Compare November 6, 2024 10:07
@toita86 toita86 marked this pull request as ready for review November 6, 2024 10:09
@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch from d589651 to eb08f30 Compare November 6, 2024 15:03
Copy link
Contributor

@TheMule71 TheMule71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciao, grazie per la PR.

@@ -13,6 +13,13 @@ class ResPartner(models.Model):
default=lambda self: self.env.company.max_invoice_in_xml,
help="Maximum number of invoices to group in a single " "XML file. 0=Unlimited",
)
use_parent_codice_destinatario = fields.Boolean(
Copy link
Contributor

@TheMule71 TheMule71 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propongo di chiamare il campo l10n_it_use_parent_codice_destinatario

(anche in vista di future integrazione con Odoo 18, i campi della localizzazione hanno in genere quel prefisso)

@@ -206,7 +206,14 @@ def fpa_to_eur(amount, invoice):
# check value code
code = self.partner_id.ipa_code
else:
code = self.partner_id.codice_destinatario
if (
Copy link
Contributor

@TheMule71 TheMule71 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

piuttosto che modificare l10n_it_fatturapa_out con questa logica, io farei una compute nella definizione del campo codice_destinatario e implementerei la logica lì, dove è definito il campo (l10n_it_fatturapa).

infatti in futuro un altro modulo potrebbe usare il codice_destinatario - se va popolato da un partner padre deve reimplementare la logica

@@ -9,6 +9,9 @@
<field name="ipa_code" position="before">
<field name="max_invoice_in_xml" />
</field>
<xpath expr="//field[@name='codice_destinatario']" position="before">
<field name="use_parent_codice_destinatario" />
</xpath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conviene anche disabilitare/grigiare/nascondere il campo codice_destinatario?

Copy link
Author

@toita86 toita86 Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grazie per la review, ho reso il campo codice_destinatario di sola lettura quando viene utilizzato il codice del padre. Per poterlo modificare, esiste il campo electronic_invoice_use_this_address.

@TheMule71
Copy link
Contributor

Aggiungo che implementando la logica in l10n_it_fatturapa, si potrebbe cercare all'indietro tutti i parent, recursivamente, fino a trovarne uno col codice_destinatario popolato.

@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch from eb08f30 to ab218ad Compare November 11, 2024 12:20
@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch 2 times, most recently from 3d8f29b to 6d72030 Compare November 12, 2024 10:35
@SirAionTech SirAionTech added the needs fixing Has conflicts or is failing mandatory CI checks label Nov 12, 2024
@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch 2 times, most recently from 36f2f25 to cf16ce2 Compare November 13, 2024 13:45
Uses the parent codice_destinatario for each child
if the parent has set the flag l10n_it_use_parent_codice_destinatario.
@toita86 toita86 force-pushed the 14.0-IMP-l10n_it_fatturapa_out-toita86 branch from cf16ce2 to 25001b8 Compare November 13, 2024 15:11
@toita86
Copy link
Author

toita86 commented Nov 14, 2024

@TheMule71, Hai idea del perchè i test falliscono?
C'è un assegnamento fallato del CAP e la provincia.

AssertionError: b'<ns[864 chars]AP>00100</CAP><Comune>Lugano</Comune><Nazione>[2000 chars]ica>' != b'<ns[864 chars]AP>00000</CAP><Comune>Lugano</Comune><Provinci[2025 chars]ica>'

Per come ho implementato la logica di assegnamento di codice_destinatario non dovrebbe cambiare nulla per questa casistica

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 needs fixing Has conflicts or is failing mandatory CI checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[l10n_it_fatturapa_out] - usare codice destinatario del commercial partner
4 participants