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

[FIX] l10n_hu_edi: Various fixes #165195

Closed

Conversation

antoine162
Copy link
Contributor

@antoine162 antoine162 commented May 13, 2024

  1. Avoid crashing if move.name is not set

In the tests

  • :TestAccountMoveInInvoiceOnchanges.test_fiduciary_mode_date_suggestion
  • :TestSequenceMixin.test_sequence_empty_editable_with_quick_edit_mode

the compute method _compute_l10n_hu_edi_attachment_filename was called before the invoice name was set.
Because of this, calling move.name.replace('/', '_') was raising an AttributeError.

  1. Allow user to not put credentials when they are using demo mode.

  2. sent (waiting for response) and confirmed_warning states should not raise a UserError and should not block an e-mail from being sent to the customer.

  3. always send modification invoices using 'MODIFY' (never 'STORNO') since 'STORNO' prevents further modifications from being issued to the invoice, but in Odoo we can't predict whether the user will want to issue further corrections to an invoice in the future.

Fixes runbot errors 64755 and 64756.

@robodoo
Copy link
Contributor

robodoo commented May 13, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label May 13, 2024
@antoine162 antoine162 force-pushed the 17.0-l10n_hu_edi-fix-nightly-tests-andu branch from a375e17 to b11c3bb Compare May 14, 2024 14:17
@antoine162 antoine162 changed the title [FIX] l10n_hu_edi: Avoid crashing if move.name is not set [FIX] l10n_hu_edi: Various fixes May 14, 2024
@antoine162 antoine162 force-pushed the 17.0-l10n_hu_edi-fix-nightly-tests-andu branch from b11c3bb to 9c981e9 Compare May 14, 2024 14:33
@antoine162 antoine162 requested a review from jco-odoo May 15, 2024 09:43
@@ -82,6 +82,18 @@ class AccountMove(models.Model):
l10n_hu_edi_messages = fields.Json(
string='Transaction messages (JSON)',
copy=False,
help="""
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good for a comment, not for the user to see anywhere. (technical comments should not be in help)

addons/l10n_hu_edi/models/account_move.py Outdated Show resolved Hide resolved
@@ -561,15 +574,15 @@ def _l10n_hu_edi_query_status_single_batch(self, connection):
'l10n_hu_edi_messages': {
'error_title': _('The invoice was sent to the NAV, but there was an error querying its status.'),
'errors': e.errors,
'blocking_level': 'error_but_continue',
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still have error_but_continue left?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No 😄
I had misunderstood the use of error_but_continue in the Send & Print: it's used in cases where the EDI has some kind of error which prevents an official tax invoice from being generated (e.g. if a QR code is missing) but we should still generate a proforma PDF.

I don't think it is applicable to Hungary, since the normal PDF can always be generated (it does not require anything retrieved from the government). Therefore, if there is an actual error (invoice rejected), we block the user with a UserError. In all other cases, we just provide a message in the banner.

I appreciate this is not the best in the case where NAV is slow, so the Send and Print returns but we are still waiting for a response from the government (in this case, we put this in the banner, but don't block the user, the PDF is generated and the e-mail is sent to the customer etc.) This might not be the best since the invoice might still be rejected later. I'll have a chat with LAS tomorrow to see whether we can do something to the Send and Print to handle this case better (which is also needed in other localizations where the sending is in 2 steps e.g. Peru).

@antoine162 antoine162 force-pushed the 17.0-l10n_hu_edi-fix-nightly-tests-andu branch from 9c981e9 to a628f07 Compare May 15, 2024 11:28
1. Avoid crashing if move.name is not set

In the tests
`:TestAccountMoveInInvoiceOnchanges.test_fiduciary_mode_date_suggestion`
`:TestSequenceMixin.test_sequence_empty_editable_with_quick_edit_mode`
the compute method `_compute_l10n_hu_edi_attachment_filename` gets
called before the invoice name is set.

Because of this, calling move.name.replace('/', '_') was raising an
AttributeError.

2. Allow user to not put credentials in demo mode.

3. sent (waiting for response) and confirmed_warning states don't raise
   a UserError and don't block an e-mail from being sent to the customer
   anymore.

4. always send modification invoices using 'MODIFY' (never 'STORNO')
   since in Odoo we can't predict whether the user will want to issue
   further corrections to an invoice in the future.

Fixes runbot errors 64755 and 64756.
@antoine162 antoine162 force-pushed the 17.0-l10n_hu_edi-fix-nightly-tests-andu branch from a628f07 to a2699b7 Compare May 15, 2024 11:32
@jco-odoo
Copy link
Contributor

@robodoo r+

@fw-bot
Copy link
Contributor

fw-bot commented May 20, 2024

@antoine162 @jco-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

1 similar comment
@fw-bot
Copy link
Contributor

fw-bot commented May 21, 2024

@antoine162 @jco-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants