Skip to content

[18.0][IMP] edi_core_oca: add backend-controlled auto-cleanup for exchange records#233

Merged
OCA-git-bot merged 1 commit intoOCA:18.0from
camptocamp:edi_exchange_record_cleaning
Apr 27, 2026
Merged

[18.0][IMP] edi_core_oca: add backend-controlled auto-cleanup for exchange records#233
OCA-git-bot merged 1 commit intoOCA:18.0from
camptocamp:edi_exchange_record_cleaning

Conversation

@Ricardoalso
Copy link
Copy Markdown
Contributor

@Ricardoalso Ricardoalso commented Feb 13, 2026

This pull request introduces automated maintenance for EDI exchange records. The most significant changes are the addition of scheduled jobs to archive and delete old EDI records and the introduction of an active flag for EDI records.

Changes:

  • Add "Auto Cleanup" tab in backend form view for easy configuration
  • Add archive cron job that respect backend-specific retention policies
  • Add delete cron job that respect backend-specific retention policies
  • Add "Archived" filter to exchange record search view

Benefits:

  • Each backend can have different retention policies
  • Setting fields to 0 (default value) disables the respective cleanup behavior
  • More flexible data retention management
  • Better control over storage and performance optimization

The cron jobs iterate through backends with configured retention
settings, applying appropriate cutoff values.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @simahawk, @etobella,
some modules you are maintaining are being modified, check this out!

@Ricardoalso Ricardoalso force-pushed the edi_exchange_record_cleaning branch from ca3e2f9 to 90cc5e6 Compare February 13, 2026 09:23
Copy link
Copy Markdown
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

If we want to do that, we need to at least add a way to decide which records can be archived. IMO, we should add a flag on exchange type or backends for that.

@Ricardoalso Ricardoalso marked this pull request as draft February 13, 2026 09:26
@Ricardoalso Ricardoalso changed the title [18.0][IMP] edi_core_oca: automated edi.exchange.record record maintenance [18.0][IMP] edi_core_oca: add backend-controlled auto-cleanup for exchange records Feb 13, 2026
@Ricardoalso Ricardoalso force-pushed the edi_exchange_record_cleaning branch from e551b22 to 9d3fe03 Compare February 13, 2026 12:23
@Ricardoalso Ricardoalso marked this pull request as ready for review February 13, 2026 12:34
@Ricardoalso
Copy link
Copy Markdown
Contributor Author

If we want to do that, we need to at least add a way to decide which records can be archived. IMO, we should add a flag on exchange type or backends for that.

Hey @etobella, thanks for the early review, you were too fast for me! 😄

Following @simahawk’s suggestion, I added the configuration to the edi.backend model and kept them disabled by default.

@Ricardoalso Ricardoalso changed the title [18.0][IMP] edi_core_oca: add backend-controlled auto-cleanup for exchange records [18.0][PERF] edi_core_oca: add backend-controlled auto-cleanup for exchange records Feb 13, 2026
@Ricardoalso Ricardoalso changed the title [18.0][PERF] edi_core_oca: add backend-controlled auto-cleanup for exchange records [18.0][IMP] edi_core_oca: add backend-controlled auto-cleanup for exchange records Feb 13, 2026
@simahawk
Copy link
Copy Markdown
Contributor

If we want to do that, we need to at least add a way to decide which records can be archived. IMO, we should add a flag on exchange type or backends for that.

You can still edit the cron to search for records by specific type.
We could add a domain to the backend but for the moment I would keep it simple.

Comment thread edi_core_oca/views/edi_backend_views.xml Outdated
@Ricardoalso Ricardoalso force-pushed the edi_exchange_record_cleaning branch from b96888d to 3183ca6 Compare February 26, 2026 16:03
Comment thread edi_core_oca/models/edi_backend.py Outdated
string="Auto-archive records after (days)",
default=0,
help="Automatically archive EDI exchange records after X days. "
"Set to 0 to disable auto-archiving.",
Copy link
Copy Markdown
Contributor

@SilvioC2C SilvioC2C Apr 24, 2026

Choose a reason for hiding this comment

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

SOLVED ✅

For consistency with the cron's code:

Suggested change
"Set to 0 to disable auto-archiving.",
"Set to <= 0 to disable auto-archiving.",

Comment thread edi_core_oca/models/edi_backend.py Outdated
string="Auto-delete archived records after (days)",
default=0,
help="Automatically delete archived EDI exchange records after X days. "
"Set to 0 to disable auto-deletion.",
Copy link
Copy Markdown
Contributor

@SilvioC2C SilvioC2C Apr 24, 2026

Choose a reason for hiding this comment

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

SOLVED ✅

For consistency with the cron's code:

Suggested change
"Set to 0 to disable auto-deletion.",
"Set to <= 0 to disable auto-deletion.",

Comment on lines +268 to +272
<filter
string="Archived"
name="filter_archived"
domain="[('active', '=', False)]"
/>
Copy link
Copy Markdown
Contributor

@SilvioC2C SilvioC2C Apr 24, 2026

Choose a reason for hiding this comment

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

SOLVED ✅

It could be useful to include filters for both active and archived records:

Suggested change
<filter
string="Archived"
name="filter_archived"
domain="[('active', '=', False)]"
/>
<filter
string="Active"
name="filter_active"
domain="[('active', '=', True)]"
/>
<filter
string="Archived"
name="filter_archived"
domain="[('active', '!=', True)]"
/>

…records

Add configurable auto-archiving and auto-deletion of EDI exchange records
per backend. This backend-specific settings that can be managed individually.

Changes:
- Add "Auto Cleanup" tab in backend form view for easy configuration
- Add archive cron job that respect backend-specific retention policies
- Add delete cron job that respect backend-specific retention policies
- Add "Archived" filter to exchange record search view

Benefits:
- Each backend can have different retention policies
- Setting fields to 0 (default value) disables the respective cleanup behavior
- More flexible data retention management
- Better control over storage and performance optimization

The cron jobs iterate through backends with configured retention
settings, applying appropriate cutoff values.

chore(edi_core_oca): update documentation
@SilvioC2C SilvioC2C force-pushed the edi_exchange_record_cleaning branch from 3183ca6 to 0d91f71 Compare April 24, 2026 13:23
@simahawk
Copy link
Copy Markdown
Contributor

@etobella ping :)

Copy link
Copy Markdown
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

Technical review

Thanks!

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@etobella
Copy link
Copy Markdown
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-233-by-etobella-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 200b0e2 into OCA:18.0 Apr 27, 2026
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at a82ba97. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants