Skip to content

[16.0] new module l10n_it_fatturapa_out_dn #4054

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

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

TheMule71
Copy link
Contributor

@TheMule71 TheMule71 commented Mar 14, 2024

Fixes #4005

Modulo di collegamento tra l10n_it_fatturapa_out e l10n_it_delivery_note
vd. anche #2202

Copy link

@MaurizioPellegrinet MaurizioPellegrinet left a comment

Choose a reason for hiding this comment

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

LGTM

@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch from bf6b932 to 06aceaf Compare May 28, 2024 14:15
@francesco-ooops
Copy link
Contributor

/ocabot rebase

@OCA-git-bot
Copy link
Contributor

@francesco-ooops The rebase process failed, because command git rebase origin/16.0 failed with output:

Rebasing (1/2)
Auto-merging l10n_it_fatturapa_out/data/invoice_it_template.xml
CONFLICT (content): Merge conflict in l10n_it_fatturapa_out/data/invoice_it_template.xml
error: could not apply 05ae68b5a... [REF] l10n_it_fatturapa_out: Allow to exclude lines from e-invoice
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 05ae68b5a... [REF] l10n_it_fatturapa_out: Allow to exclude lines from e-invoice

@francesco-ooops
Copy link
Contributor

@TheMule71 puoi fare rebase?

@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch 2 times, most recently from 961fdea to ce6af3e Compare August 9, 2024 08:32
@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch from ce6af3e to 662c34e Compare October 21, 2024 12:59
@TheMule71
Copy link
Contributor Author

ValueError: External ID not found in the system: l10n_it.l10n_it_chart_template_generic

La modifica è stata introdotta con #4176. Per caso è cambiato qualcosa nell'ambiente di esecuzione dei test (e l10n_it non è più presente?)

In ogni caso prob. va fixato visto che non deve dipendere da l10n_it.

"NumeroDDT": delivery_note.name,
"DataDDT": delivery_note.date,
}
e_invoice_lines = self.get_e_invoice_lines(invoice)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ho cambiato questa parte così per mettere il riferimentonumerolinea solo se c'è più di un DN collegato e togliere le righe nota/sezione:

if len(invoice.delivery_note_ids) > 1:
    # RiferimentoNumeroLinea should not be populated
    # if all the lines of the invoice
    # are linked to this delivery_note
    e_invoice_lines = self.get_e_invoice_lines(invoice)
    e_invoice_delivery_note_lines = e_invoice_lines.filtered(
        lambda eil, delivery_note=delivery_note:
        eil.delivery_note_id == delivery_note and eil.display_type == 'product')

    e_invoice_lines_list = list(e_invoice_lines)
    lines_refs_list = [
        e_invoice_lines_list.index(line) + 1  # NumeroLinea is 1-based
        for line in e_invoice_delivery_note_lines
    ]

    ddt_data.update(
        {
            "_invoice_lines": e_invoice_delivery_note_lines,
            "RiferimentoNumeroLinea": lines_refs_list,
        }
    )

    dati_ddt_list.append(ddt_data)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Non seguo la logica, in che senso se len(invoice.delivery_note_ids) > 1 allora tutte le righe fattura sono collegate allo stesso DDT?
Potrebbero esserci righe che non sono collegate al DDT.

È vero che probabilmente la maggior parte delle volte non sarebbe un problema perché tali righe saranno magari per servizi e quindi va da sé che non riguardano il DDT. Però è una considerazione di pratica, in teoria nulla vieta questo scenario:

crei SO -> consegni -> crei DDT -> crei fattura
ora aggiungi uno o più prodotti alla fattura

prima avrebbe riportato nell'XML i riferimenti alle sole righe derivate del DDT;
se non sbaglio, con questa modifica, riporterebbe l'intera fattura riferita al quel DDT, e se uno va a cercare i prodotti aggiunti dopo in fattura nel DDT non li trova.

Copy link
Contributor

Choose a reason for hiding this comment

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

Non seguo la logica, in che senso se len(invoice.delivery_note_ids) > 1 allora tutte le righe fattura sono collegate allo stesso DDT?

No, collego solo quelle che appartengono ai DN come si vede in questo passaggio:

e_invoice_delivery_note_lines = e_invoice_lines.filtered(
        lambda eil, delivery_note=delivery_note:
        eil.delivery_note_id == delivery_note and eil.display_type == 'product')

se non sbaglio, con questa modifica, riporterebbe l'intera fattura riferita al quel DDT, e se uno va a cercare i prodotti aggiunti dopo in fattura nel DDT non li trova.

se committi queste modifiche le si può provare anche nel runboat e dovresti vedere che funziona
lo stiamo usando in produzione da un cliente, ho fatto un test con il flusso che hai indicato e correttamente la riga aggiunta post in fattura non viene collegata a DN

Copy link
Contributor Author

@TheMule71 TheMule71 Dec 13, 2024

Choose a reason for hiding this comment

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

Ok, ma quello lo fai se len(invoice.delivery_note_ids) > 1.

Il caso che ho portato era per len(invoice.delivery_note_ids) == 1.

Rileggendo nel mio commento precedente non è chiaro, riformulo:

Non seguo la logica, in che senso se len(invoice.delivery_note_ids) == 1 allora tutte le righe fattura sono collegate allo stesso DDT?

@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch 2 times, most recently from 292aed2 to c02958d Compare December 12, 2024 15:27
@SirAionTech SirAionTech removed the needs fixing Has conflicts or is failing mandatory CI checks label Dec 18, 2024
@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch 2 times, most recently from 173564b to e3a0c81 Compare March 18, 2025 11:06
@TheMule71
Copy link
Contributor Author

Ok ho rivisto alcune cose, adesso delivery_note_id è popolato anche per le righe prodotto, per cui è possibile controllare quando aggiungere i riferimenti alle righe oppure no nella stanza DatiDDT

@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch 2 times, most recently from 5a4610b to 173564b Compare March 18, 2025 22:20
@TheMule71
Copy link
Contributor Author

TheMule71 commented Mar 18, 2025

Ok, come non detto, delivery_note_id NON è popolato per le righe prodotto.

Si torna a 173564b

l10n_it_delivery_note non è ancora pronto per la patch, ma ai suoi figli piacerà

@odooNextev

e_invoice_delivery_note_lines = e_invoice_lines.filtered(
        lambda eil, delivery_note=delivery_note:
        eil.delivery_note_id == delivery_note and eil.display_type == 'product')

è sempre vuoto.

@odooNextev
Copy link
Contributor

Ok, come non detto, delivery_note_id NON è popolato per le righe prodotto.

Si torna a 173564b

l10n_it_delivery_note non è ancora pronto per la patch, ma ai suoi figli piacerà

@odooNextev

e_invoice_delivery_note_lines = e_invoice_lines.filtered(
        lambda eil, delivery_note=delivery_note:
        eil.delivery_note_id == delivery_note and eil.display_type == 'product')

è sempre vuoto.

Io lo trovo impostato ed il modulo con questa modifica sta funzionando in produzione da un cliente da mesi:

image

@TheMule71
Copy link
Contributor Author

delivery_note_id

Tu hai righe prodotto con delivery_note_id != False? perché io non ne vedo (mettendo debug sui test). delivery_note_id è popolato solo per le righe note.

Ho disfatto la patch perché i test non passavano. A questo punto ti direi di fare una PR a questa PR, così vediamo i test verdi.

@odooNextev
Copy link
Contributor

delivery_note_id

Tu hai righe prodotto con delivery_note_id != False? perché io non ne vedo (mettendo debug sui test). delivery_note_id è popolato solo per le righe note.

Ho disfatto la patch perché i test non passavano. A questo punto ti direi di fare una PR a questa PR, così vediamo i test verdi.

TheMule71#40

@TheMule71 TheMule71 marked this pull request as draft April 7, 2025 07:24
@TheMule71
Copy link
Contributor Author

@odooNextev
messa in draft perché i test non passano, anche se non sembra colpa nostra

@TheMule71
Copy link
Contributor Author

@odooNextev
test rilanciati

@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch from 74c94b6 to 9cafc9b Compare May 16, 2025 07:51
@TheMule71 TheMule71 force-pushed the 16.0-mig-l10n_it_fatturapa_out_dn branch 2 times, most recently from e76520a to 4b7a78a Compare June 13, 2025 10:11
@TheMule71
Copy link
Contributor Author

Mi sa che la tua PR in realtà dipende da: #4385

@TheMule71 TheMule71 marked this pull request as ready for review June 13, 2025 10:17
Copy link
Contributor

@Borruso Borruso left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

l10n_fatturapa_out: output delivery note data in XML
8 participants