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 l10n_it_fatturapa documenti correlati non vengono salvati #2211

Open
2 tasks
TheMule71 opened this issue Apr 9, 2021 · 10 comments
Open
2 tasks

14.0 l10n_it_fatturapa documenti correlati non vengono salvati #2211

TheMule71 opened this issue Apr 9, 2021 · 10 comments
Assignees
Labels
14.0 bug hotfix no stale Use this label to prevent the automated stale action from closing this PR/Issue. required

Comments

@TheMule71
Copy link
Contributor

TheMule71 commented Apr 9, 2021

NOTA: dopo il merge di #1984

Ciao @TheMule71,
a quanto pare i documenti correlati non vengono salvati e/o spariscono.
Non ho ancora investigato sulla causa.

Il motivo per cui i related_documents (e admin_ref) non vengono salvati è che il core esclude le modifiche a invoice_line_ids in https://github.com/odoo/odoo/blob/d44dfff647939022b8fe8d091bc1f6562cc47d86/addons/account/models/account_move.py#L1872.
Per qualche motivo i related_documents vengono passati come modifica a invoice_line_ids mentre ad esempio le imposte sono passate comunque come modifiche a line_ids:
image
Abbiamo fatto un po' di indagini su questo problema senza arrivare a una soluzione.
Sembra ci sia qualche meccanismo oscuro per cui dei campi vengono copiati da invoice_line_ids a line_ids (vedi ad esempio i metodi create, write e _onchange_invoice_line_ids di account.move.line).

Originally posted by @SimoRubi in #1984 (comment)

@fredzamoabg
Copy link
Contributor

@TheMule71 facendo prove in quest'area ho notato che inserendo il campo anche nella vista lista di line_ids questa issue non si presenta, esempio:

<xpath expr="//field[@name='invoice_line_ids']/form/sheet/field[@name='name']"
       position="after">
    <field name="nuovo_campo"/>
</xpath>
<xpath expr="//field[@name='line_ids']/tree" position="inside">
    <field name="nuovo_campo" invisible="1"/>
</xpath>

@tafaRU
Copy link
Member

tafaRU commented Dec 31, 2021

Il problema evidenziato si verifica quando sono installati sia l10n_it_fatturapa_out sia l10n_it_fatturapa_in.
Questo perché related_documents viene messo a readonly in questo punto e di conseguenza su di esso non viene chiamata la write.
La migrazione della vista l10n_it_fatturapa_in.view_invoice_form_fatturapa_in è da rivedere perché ad esempio contiene ancora riferimenti a viste che sulla 14.0 non ci sono più:

  • account.invoice_supplier_form: punto 1 e punto 2
  • account.invoice_supplier_tree: qui

Oltre a capire come farla convivere quando è installato anche l10n_it_fatturapa_out.

@GSLabIt
Copy link
Contributor

GSLabIt commented Jan 8, 2022

Il problema evidenziato si verifica quando sono installati sia l10n_it_fatturapa_out sia l10n_it_fatturapa_in.
Questo perché related_documents viene messo a readonly in questo punto e di conseguenza su di esso non viene chiamata la write.
La migrazione della vista l10n_it_fatturapa_in.view_invoice_form_fatturapa_in è da rivedere perché ad esempio contiene ancora riferimenti a viste che sulla 14.0 non ci sono più:

  • account.invoice_supplier_form: punto 1 e punto 2
  • account.invoice_supplier_tree: qui

Oltre a capire come farla convivere quando è installato anche l10n_it_fatturapa_out.

Potrebbe essere sufficiente aggiungere un force_save = "1" su related_documents quando si aggiunge readonly="1"?

tafaRU added a commit to tafaRU/l10n-italy that referenced this issue Jan 11, 2022
…elong to account.move form when l10n_it_fatturapa_in is installed after l10n_it_fatturapa_out

This change fixes the following scenario:

- install l10n_it_fatturapa_out
- install l10n_it_fatturapa_in
- tick the flag *Enable electronic invoicing* on a partner
- create an invoice for the previous partner
- add some lines in Related Document
- related documents are not saved

This is due to the order in which `account.view_move_form` inherited views are loaded (ref. https://github.com/odoo/odoo/blob/293f54336fe18b41579604a20969534006437460/odoo/addons/base/models/ir_ui_view.py#L595)

And it closes OCA#2211
tafaRU added a commit to tafaRU/l10n-italy that referenced this issue Jan 11, 2022
…elong to account.view_move_form when l10n_it_fatturapa_in is installed after l10n_it_fatturapa_out

This change fixes the following scenario:

- install l10n_it_fatturapa_out
- install l10n_it_fatturapa_in
- tick the flag *Enable electronic invoicing* on a partner
- create an invoice for the previous partner
- add some lines in Related Document
- related documents are not saved

This is due to the order in which `account.view_move_form` inherited views are loaded (ref. https://github.com/odoo/odoo/blob/293f54336fe18b41579604a20969534006437460/odoo/addons/base/models/ir_ui_view.py#L595)

And it closes OCA#2211
@tafaRU
Copy link
Member

tafaRU commented Jan 11, 2022

Potrebbe essere sufficiente aggiungere un force_save = "1" su related_documents quando si aggiunge readonly="1"?

@GSLabIt grazie del suggerimento. Ho provato però non ha funzionato. Ho invece risolto con #2586

@eLBati
Copy link
Member

eLBati commented Jan 20, 2022

Quindi questa si può chiudere?

@SimoRubi
Copy link
Member

Quindi questa si può chiudere?

No perché abbiamo chiarito in #2586 (comment) (riporto qui sotto) che la PR #2586 non risolve questo problema:

And it closes #2211

La issue #2211 parla dei documenti correlati assegnati alle righe invoice_line_ids mentre dalla descrizione mi pare che questa PR risolva un problema per i documenti correlati associati alla fattura qundi non credo risolva la issue indicata.

Copy link

github-actions bot commented Jan 7, 2024

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 7, 2024
@francesco-ooops francesco-ooops added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Jan 7, 2024
@francesco-ooops
Copy link
Contributor

@aleuffre puoi verificare se si presenta anche sulla 16?

aleuffre added a commit to PyTech-SRL/l10n-italy that referenced this issue Jan 8, 2024
@aleuffre
Copy link
Contributor

aleuffre commented Jan 8, 2024

Sinceramente, non riesco nemmeno ad arrivarci sulla v16.

Ho trovato il campo ma riesco a vederlo solo se la fattura è già confermata, e quindi il campo è readonly (peraltro si vede male)

image

ma fintanto che la fattura è aperta e ancora modificabile non riesco ad arrivarci...

@francesco-ooops
Copy link
Contributor

francesco-ooops commented Jan 8, 2024

@TheMule71 riesci a fare il punto su questa issue? grazie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 bug hotfix no stale Use this label to prevent the automated stale action from closing this PR/Issue. required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants