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

Poter aprire una distinta RiBa quando la fattura collegata è stata eliminata #3814

Closed
2 tasks done
SirAionTech opened this issue Jan 5, 2024 · 3 comments · Fixed by #3813 or #4493
Closed
2 tasks done

Poter aprire una distinta RiBa quando la fattura collegata è stata eliminata #3814

SirAionTech opened this issue Jan 5, 2024 · 3 comments · Fixed by #3813 or #4493
Labels
14.0 bug needs porting This issue has already been resolved for some version no stale Use this label to prevent the automated stale action from closing this PR/Issue. triaged

Comments

@SirAionTech
Copy link
Contributor

SirAionTech commented Jan 5, 2024

Module

l10n_it_riba

Describe the bug

Provando ad aprire la distinta RiBa si ottiene:

  ...
  File "/mnt/data/odoo-addons-dir/l10n_it_riba/models/riba.py", line 225, in _compute_line_values
      ).strftime("%d/%m/%Y")
  AttributeError: 'NoneType' object has no attribute 'strftime'

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Creare una fattura con RiBa
  2. Confermare la fattura
  3. Emettere la RiBa
  4. Riportare in bozza la fattura
  5. Eliminare la fattura
  6. Aprire la RiBa

Expected behavior
Nessun errore

@SirAionTech SirAionTech added the bug label Jan 5, 2024
@SirAionTech SirAionTech linked a pull request Jul 12, 2024 that will close this issue
@francesco-ooops francesco-ooops added the needs porting This issue has already been resolved for some version label Nov 8, 2024
@SirAionTech SirAionTech added the no stale Use this label to prevent the automated stale action from closing this PR/Issue. label Nov 8, 2024
@tafaRU tafaRU added the triaged label Nov 15, 2024
@toita86
Copy link

toita86 commented Dec 9, 2024

Ciao @SirAionTech, nel runboat della 14.0 non riesco a riprodurre i passi che hai descritto.

Steps to reproduce the behavior:

Creare una fattura con RiBa
Confermare la fattura
Emettere la RiBa
Riportare in bozza la fattura
Eliminare la fattura

il mio punto di blocco è qui
image

sto cercando di portare questa PR #3813 alla 14 ma il test introdotto qui f2dc4c6#diff-429c4f56afd08397de9cdd8888c36bf998bfe1bff27c020e7339ab36973955d7R619 si blocca esattamente alla parte in cui si cerca di eliminare la fattura.

da traceback:

2024-12-09 10:48:23,448 20 ERROR devel odoo.addons.l10n_it_ricevute_bancarie.tests.test_riba: ERROR: TestInvoiceDueCost.test_riba_line_date_no_move
Traceback (most recent call last):
  File "/opt/odoo/auto/addons/l10n_it_ricevute_bancarie/tests/test_riba.py", line 643, in test_riba_line_date_no_move
    self.invoice.unlink()
  File "/opt/odoo/auto/addons/l10n_it_fatturapa_sale/models/account_move.py", line 12, in unlink
    res = super().unlink()
  File "/opt/odoo/auto/addons/sale/models/account_invoice.py", line 40, in unlink
    res = super(AccountMove, self).unlink()
  File "/opt/odoo/auto/addons/account/models/account_move.py", line 2144, in unlink
    raise UserError(_("You cannot delete an entry which has been posted once."))
odoo.exceptions.UserError: You cannot delete an entry which has been posted once.

Se si cercasse di annullare la registrazione appare il warning nello screenshot precedente rendendo cosi impossibile cancellare la fattura.

@SirAionTech
Copy link
Contributor Author

Ciao @SirAionTech, nel runboat della 14.0 non riesco a riprodurre i passi che hai descritto.

Steps to reproduce the behavior:
Creare una fattura con RiBa
Confermare la fattura
Emettere la RiBa
Riportare in bozza la fattura
Eliminare la fattura

il mio punto di blocco è qui image

sto cercando di portare questa PR #3813 alla 14 ma il test introdotto qui f2dc4c6#diff-429c4f56afd08397de9cdd8888c36bf998bfe1bff27c020e7339ab36973955d7R619 si blocca esattamente alla parte in cui si cerca di eliminare la fattura.

da traceback:

2024-12-09 10:48:23,448 20 ERROR devel odoo.addons.l10n_it_ricevute_bancarie.tests.test_riba: ERROR: TestInvoiceDueCost.test_riba_line_date_no_move
Traceback (most recent call last):
  File "/opt/odoo/auto/addons/l10n_it_ricevute_bancarie/tests/test_riba.py", line 643, in test_riba_line_date_no_move
    self.invoice.unlink()
  File "/opt/odoo/auto/addons/l10n_it_fatturapa_sale/models/account_move.py", line 12, in unlink
    res = super().unlink()
  File "/opt/odoo/auto/addons/sale/models/account_invoice.py", line 40, in unlink
    res = super(AccountMove, self).unlink()
  File "/opt/odoo/auto/addons/account/models/account_move.py", line 2144, in unlink
    raise UserError(_("You cannot delete an entry which has been posted once."))
odoo.exceptions.UserError: You cannot delete an entry which has been posted once.

Se si cercasse di annullare la registrazione appare il warning nello screenshot precedente rendendo cosi impossibile cancellare la fattura.

👋 la fattura va eliminata, non annullata.

Per risolvere l'errore nel test, va bypassato il controllo di 14.0 https://github.com/odoo/odoo/blob/f33e80dc4a98d0234d531d5f6a3950de124510bc/addons/account/models/account_move.py#L2143-L2144:

            if move.posted_before and not self._context.get('force_delete'):
                raise UserError(_("You cannot delete an entry which has been posted once."))

e si può fare mettendo nel contesto force_delete; da interfaccia si potrebbe creare un'azione server che aggiunge quel contesto ed elimina.

Comunque se gli stessi passi non si possono replicare in 14.0 magari vuol dire che il problema non esiste in questa versione.

@toita86
Copy link

toita86 commented Dec 9, 2024

@SirAionTech esaustivo come al solito, grazie mille per la spiegazione.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 bug needs porting This issue has already been resolved for some version no stale Use this label to prevent the automated stale action from closing this PR/Issue. triaged
Projects
None yet
4 participants