[18.0][IMP] l10n_it_edi_extension: add AltriDatiGestionali (2.2.1.16) export support for XML invoices#5025
Conversation
48a416e to
af47b34
Compare
e76c7c6 to
da099be
Compare
463c060 to
d303351
Compare
| on account.move.line records and exported into the FatturaPA XML. | ||
| """ | ||
|
|
||
| _name = "l10n_it_edi.move.line.other.data" |
There was a problem hiding this comment.
aggiunge già l10n_it_edi.line_other_data
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
OK, abbiamo detto di usare l10n_it_edi.line_other_data anche per l'esportazione
|
|
||
| _name = "l10n_it_edi.move.line.other.data" | ||
| _description = "Invoice Line Other Data for Export" | ||
| _rec_name = "display_name" |
There was a problem hiding this comment.
Visto che abbiamo già il campo name, come mai impostare display_name? Non rompe name_search() e name_get()?
There was a problem hiding this comment.
name è soltanto il TipoDato e da quello non si capisce bene cosa rappresenti la riga
There was a problem hiding this comment.
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
| <field name="arch" type="xml"> | ||
| <list editable="bottom"> | ||
| <field name="move_line_id" column_invisible="1" /> | ||
| <field name="name" string="Tipo Dato" /> |
There was a problem hiding this comment.
Qui come in altri punti: non mettiamo in inglese?
| <field name="l10n_it_edi_admin_ref" optional="hide" /> | ||
| <field | ||
| name="l10n_it_edi_other_data_ids" | ||
| widget="many2many_tags" |
There was a problem hiding this comment.
Come mai many2many_tags? Gestisce correttamente la creazione/scrittura/eliminazione dei record?
There was a problem hiding this comment.
è 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
There was a problem hiding this comment.
non ho capito se funzionano creazione/scrittura/eliminazione
There was a problem hiding this comment.
Forse il problema è collegato alla necessità di avere def action_delete?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Meglio renderlo eseguibile solo in bozza?
There was a problem hiding this comment.
Va bene anche dopo la conferma, verifico che vengano riportati nell'xml anche se messi in fattura confermata
There was a problem hiding this comment.
Allora almeno impedirlo per gli XML generati
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Non possiamo usare size=10 sul campo?
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Non possiamo usare size=60 sul campo?
There was a problem hiding this comment.
seguendo questo commento, verrà risolto: #5025 (comment)
a491335 to
e6ef3e3
Compare
de0e11b to
6c4905c
Compare
|
|
||
| _name = "l10n_it_edi.line_other_data" | ||
| _description = "E-invoice line other data" | ||
| _rec_name = "display_name" |
97611eb to
8ed5d92
Compare
| digits=(16, 8), | ||
| help="RiferimentoNumero: Numeric reference (up to 8 decimal places)", | ||
| ) | ||
| date_ref = fields.Date( |
There was a problem hiding this comment.
Questo ha bisogno di script di upgrade immagino
There was a problem hiding this comment.
Perchè ho tolto readonly?
There was a problem hiding this comment.
| column_invisible="parent.country_code != 'IT'" | ||
| /> | ||
| <button | ||
| name="action_open_other_data" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
5759ced to
72f3777
Compare
…t support for XML invoices
72f3777 to
0ee8a1a
Compare
|
This PR has the |
|
/ocabot merge minor |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at c7fc9ea. Thanks a lot for contributing to OCA. ❤️ |
Aggiunta nelle righe fattura di un campo per l'inserimento di altri dati gestionali