Skip to content

[18.0][IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices#5025

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
odooNextev:18.0-imp-l10n_it_edi_extension-altridatigest
Mar 18, 2026
Merged

[18.0][IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices#5025
OCA-git-bot merged 1 commit into
OCA:18.0from
odooNextev:18.0-imp-l10n_it_edi_extension-altridatigest

Conversation

@VBNext

@VBNext VBNext commented Dec 5, 2025

Copy link
Copy Markdown

Aggiunta nelle righe fattura di un campo per l'inserimento di altri dati gestionali

@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch from 48a416e to af47b34 Compare December 5, 2025 15:07

@MaurizioPellegrinet MaurizioPellegrinet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test funzionale: OK

@VBNext VBNext changed the title [IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) expor… [IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices Dec 5, 2025
@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch from e76c7c6 to da099be Compare December 5, 2025 16:25
@VBNext VBNext changed the title [IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices [18.0][IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices Dec 5, 2025
@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch 2 times, most recently from 463c060 to d303351 Compare December 9, 2025 10:16
on account.move.line records and exported into the FatturaPA XML.
"""

_name = "l10n_it_edi.move.line.other.data"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fc571b2

aggiunge già l10n_it_edi.line_other_data

@VBNext VBNext Dec 12, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fc571b2

aggiunge già l10n_it_edi.line_other_data

Ho creato un nuovo modello collegato direttamente a account.move.line (NON a l10n_it_edi.line) perchè
l10n_it_edi.line_other_data viene utilizzato per VISUALIZZARE dati importati (readonly)
l10n_it_edi.move.line.other.data serve per INSERIRE dati da esportare (editabile)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, abbiamo detto di usare l10n_it_edi.line_other_data anche per l'esportazione

@monen17 monen17 added the missing issue PRs must be linked to an issue. See the wiki. label Jan 9, 2026

_name = "l10n_it_edi.move.line.other.data"
_description = "Invoice Line Other Data for Export"
_rec_name = "display_name"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Visto che abbiamo già il campo name, come mai impostare display_name? Non rompe name_search() e name_get()?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

name è soltanto il TipoDato e da quello non si capisce bene cosa rappresenti la riga

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per modificare cosa viene mostrato nei campi relazionali che fanno riferimento a questi record, si fa override di _compute_display_name.
Per modificare cosa viene ritornato dalla ricerca in questi campi relazionali, si fa override di name_search

_rec_name si usa tipicamente quando non c'è un campo name e si vuole usare un altro campo in sua vece

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fatto

<field name="arch" type="xml">
<list editable="bottom">
<field name="move_line_id" column_invisible="1" />
<field name="name" string="Tipo Dato" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Qui come in altri punti: non mettiamo in inglese?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rimosso string

<field name="l10n_it_edi_admin_ref" optional="hide" />
<field
name="l10n_it_edi_other_data_ids"
widget="many2many_tags"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Come mai many2many_tags? Gestisce correttamente la creazione/scrittura/eliminazione dei record?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

è l'unico modo per visualizzare un one2many in un altro one2many ed è per questo che ho personalizzato il nome visualizzato, altrimenti non si sarebbero visti i dettagli della riga

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non ho capito se funzionano creazione/scrittura/eliminazione

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Forse il problema è collegato alla necessità di avere def action_delete?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non ho capito se funzionano creazione/scrittura/eliminazione

Probabilmente no:

The many2many_tags widget in Odoo 18 declares supportedTypes: ["many2many"] — it is explicitly designed only for Many2many fields.

Odoo's field registry does not enforce supportedTypes at runtime. So putting widget="many2many_tags" on a One2many field won't throw an error at load time. The tags may even render visually.

The Many2ManyTagsField component internally uses useX2ManyCrud() with fieldType: "many2many" hardcoded. Many2many and One2many have different CRUD semantics:

  • Many2many: link/unlink operations (commands (3, id) and (4, id))
  • One2many: create/delete operations (commands (0, 0, vals) and (2, id))

So operations like adding/removing tags will likely produce the wrong ORM commands, leading to silent data corruption or errors on save.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prova ad aprire il runboat, ho aggiunto un bottoncino per permettere di aggiungere, modificare ed eliminare i record, il widget effettivamente serve solo per la visualizzazione

column_invisible="parent.country_code != 'IT'"
/>
<button
name="action_open_other_data"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Meglio renderlo eseguibile solo in bozza?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Va bene anche dopo la conferma, verifico che vengano riportati nell'xml anche se messi in fattura confermata

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Allora almeno impedirlo per gli XML generati

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sì, ci sta

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

l'ho nascosto anche per in_invoice e in_refund

@api.constrains("name")
def _check_name_length(self):
for record in self:
if record.name and len(record.name) > 10:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Non possiamo usare size=10 sul campo?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seguendo questo commento, verrà risolto: #5025 (comment)

@api.constrains("text_ref")
def _check_text_ref_length(self):
for record in self:
if record.text_ref and len(record.text_ref) > 60:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Non possiamo usare size=60 sul campo?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seguendo questo commento, verrà risolto: #5025 (comment)

@odooNextev odooNextev force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch from a491335 to e6ef3e3 Compare February 13, 2026 15:21
@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch 5 times, most recently from de0e11b to 6c4905c Compare February 20, 2026 14:41
@VBNext VBNext requested review from TheMule71 and eLBati February 20, 2026 15:04

_name = "l10n_it_edi.line_other_data"
_description = "E-invoice line other data"
_rec_name = "display_name"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Qui vedo sempre display_name (#5025 (comment))

@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch 2 times, most recently from 97611eb to 8ed5d92 Compare February 26, 2026 11:10
digits=(16, 8),
help="RiferimentoNumero: Numeric reference (up to 8 decimal places)",
)
date_ref = fields.Date(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Questo ha bisogno di script di upgrade immagino

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perchè ho tolto readonly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perchè passa da char a date

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

column_invisible="parent.country_code != 'IT'"
/>
<button
name="action_open_other_data"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Allora almeno impedirlo per gli XML generati

<field name="l10n_it_edi_admin_ref" optional="hide" />
<field
name="l10n_it_edi_other_data_ids"
widget="many2many_tags"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Forse il problema è collegato alla necessità di avere def action_delete?

<field name="l10n_it_edi_admin_ref" optional="hide" />
<field
name="l10n_it_edi_other_data_ids"
widget="many2many_tags"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non ho capito se funzionano creazione/scrittura/eliminazione

Probabilmente no:

The many2many_tags widget in Odoo 18 declares supportedTypes: ["many2many"] — it is explicitly designed only for Many2many fields.

Odoo's field registry does not enforce supportedTypes at runtime. So putting widget="many2many_tags" on a One2many field won't throw an error at load time. The tags may even render visually.

The Many2ManyTagsField component internally uses useX2ManyCrud() with fieldType: "many2many" hardcoded. Many2many and One2many have different CRUD semantics:

  • Many2many: link/unlink operations (commands (3, id) and (4, id))
  • One2many: create/delete operations (commands (0, 0, vals) and (2, id))

So operations like adding/removing tags will likely produce the wrong ORM commands, leading to silent data corruption or errors on save.

@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch 3 times, most recently from 5759ced to 72f3777 Compare February 26, 2026 17:04
@stenext stenext force-pushed the 18.0-imp-l10n_it_edi_extension-altridatigest branch from 72f3777 to 0ee8a1a Compare March 13, 2026 11:14

@andreampiovesana andreampiovesana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@VBNext VBNext requested a review from eLBati March 13, 2026 14:00

@eLBati eLBati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Grazie

@TheMule71 TheMule71 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@eLBati

eLBati commented Mar 18, 2026

Copy link
Copy Markdown
Member

/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-5025-by-eLBati-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7137f1b into OCA:18.0 Mar 18, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at c7fc9ea. Thanks a lot for contributing to OCA. ❤️

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

Labels

approved merged 🎉 missing issue PRs must be linked to an issue. See the wiki. ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.