[16.0] account_invoice_transmit_peppol: Speedup and indepotent - #14
Open
lmignon wants to merge 2 commits into
Open
[16.0] account_invoice_transmit_peppol: Speedup and indepotent#14lmignon wants to merge 2 commits into
lmignon wants to merge 2 commits into
Conversation
lmignon
force-pushed
the
16.0-account_invoice_transmit_peppol-one-transfer-job
branch
4 times, most recently
from
January 21, 2026 14:05
876f66f to
7ca0da0
Compare
jbaudoux
reviewed
Jan 22, 2026
Comment on lines
+15
to
+16
| not self.is_move_sent | ||
| and not self.invoice_exported |
Contributor
There was a problem hiding this comment.
Allow resending in case of delivery failure
Suggested change
| not self.is_move_sent | |
| and not self.invoice_exported | |
| not invoice_export_confirmed |
jbaudoux
reviewed
Jan 22, 2026
| priority=40, | ||
| channel="root.invoice_transmit.peppol", | ||
| )._transmit_invoice_by_peppol() | ||
| if not invoice._is_transmissible_by_peppol(): |
Contributor
There was a problem hiding this comment.
Maybe generate a first job calling
to update invoice_export_confirmed
Contributor
Author
There was a problem hiding this comment.
We should create a delayable method on the invoice itself to check its status...
Contributor
There was a problem hiding this comment.
That sounds a good idea if invoice_export is True. That would be a limited number of case
* Uses the invoice's name into the job description in place of the dislay_name since the last one consume a lot of ressources to be computed * Makes the delayed method idempotent
lmignon
force-pushed
the
16.0-account_invoice_transmit_peppol-one-transfer-job
branch
from
January 22, 2026 09:21
7ca0da0 to
9437113
Compare
Contributor
lmignon
marked this pull request as ready for review
May 22, 2026 06:21
lmignon
commented
May 22, 2026
Comment on lines
21
to
48
| @@ -18,20 +28,27 @@ def _batch_transmit_invoice_by_peppol(self): | |||
| """ | |||
| result = [] | |||
| for invoice in self: | |||
| description = _( | |||
| "Generating invoice for peppol sending: %(name)s", | |||
| name=invoice.display_name, | |||
| ) | |||
| invoice.with_delay( | |||
| description=description, | |||
| identity_key=identity_exact, | |||
| priority=40, | |||
| channel="root.invoice_transmit.peppol", | |||
| )._transmit_invoice_by_peppol() | |||
| if not invoice._is_transmissible_by_peppol(): | |||
| description = _( | |||
| "Invoice already sent to peppol: %(name)s", | |||
| name=invoice.name, | |||
| ) | |||
| else: | |||
| description = _( | |||
| "Generating invoice for peppol sending: %(name)s", | |||
| name=invoice.name, | |||
| ) | |||
| invoice.with_delay( | |||
| description=description, | |||
| identity_key=identity_exact, | |||
| priority=40, | |||
| channel="root.invoice_transmit.peppol", | |||
| )._transmit_invoice_by_peppol() | |||
| result.append(description) | |||
| return "\n".join(result) | |||
Contributor
Author
There was a problem hiding this comment.
A pattern I like and implement now in my code is to create a method returning a delayable receiving job_options as arguments and call delay on the delayable returned by the method. In this way, it can be extended to change or fine tune the job_options according to a specific project need...
Suggested change
| def _batch_transmit_invoice_by_peppol(self): | |
| """Mass sending by peppol | |
| """ | |
| for invoice in self: | |
| if not invoice._is_transmissible_by_peppol(): | |
| description = _( | |
| "Invoice already sent to peppol: %(name)s", | |
| name=invoice.name, | |
| ) | |
| else: | |
| description = _( | |
| "Generating invoice for peppol sending: %(name)s", | |
| name=invoice.name, | |
| ) | |
| invoice._enqueue_transmit_invoice_by_peppol(description=description).delay() | |
| result.append(description) | |
| return "\n".join(result) | |
| def _enqueue_transmit_invoice_by_peppol(self, **job_options): | |
| self.ensure_one() | |
| job_options = job_options.copy() | |
| job_options.setdefault("identity_key", identity_exact") | |
| job_options.setdefault("priority", 40) | |
| job_options.setdefault("channel", "root.invoice_transmit.peppol") | |
| delayable = self.delayable(**job_options) | |
| return delayable._transmit_invoice_by_peppol() | |
| `` |
…oices avoid retransmitting invoices through Peppol when `invoice_export` is already set `invoice_export_confirmed` may be updated later by the status check cron, so relying only on this field can allow the same document to be sent again before the confirmation is synchronized
sbejaoui
force-pushed
the
16.0-account_invoice_transmit_peppol-one-transfer-job
branch
from
May 22, 2026 13:22
0ceb3c5 to
7e00771
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.