social icon indicating copy to clipboard operation
social copied to clipboard

[IMP] mail_notification_history: make configurable from UI

Open mkoeck opened this issue 2 months ago • 4 comments

This pull request updates the way the "Mail Notification With History" feature is enabled and managed in Odoo, shifting from a code-based configuration to a user-friendly setting in the UI. It also introduces additional translations and updates related documentation and tests.

Configuration and Feature Activation:

  • The mechanism to enable mail history in notifications is now managed via a new include_mail_history Boolean field on the ir.model model, configurable through the Odoo UI (Settings → Technical → Database Structure → Models), instead of a Python class variable (_mail_notification_include_history). [1] [2] [3] [4]

Documentation Updates:

  • All documentation and installation instructions have been updated to reflect the new UI-based activation method, replacing references to the old class variable approach. [1] [2] [3]

Testing Adjustments:

  • Tests have been refactored to set the new include_mail_history field on models, instead of patching the class variable, to reflect the new configuration approach. [1] [2]

Translation and Internationalization:

  • Added a German translation file (de.po) and updated the translation template (mail_notification_with_history.pot) to include new field labels and help texts for the new feature. [1] [2] [3]

Module Manifest and File Structure:

  • Updated the module manifest to include the new view for the ir.model form and removed obsolete code and imports related to the previous activation method. [1] [2] [3] [4]

mkoeck avatar Nov 10 '25 13:11 mkoeck

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

OCA-git-bot avatar Nov 10 '25 13:11 OCA-git-bot

Good thing that it would be configurable through the UI. But this change, without migration script, will break the module for the one already using it :exclamation:

TDu avatar Nov 11 '25 12:11 TDu

Hi @TDu thank you for your quick response. I added a migration script that should fix this I think. Unfortunately it requires the upgrade util - I did not find a better way to do it without it. I guess if the dependency is not wanted, I could also copy paste the env function from the upgrade utils into the upgrade script.

Also added a deprecation warning should the attribute still be set on a class. What do you think?

mkoeck avatar Nov 11 '25 17:11 mkoeck

I just reran the pre-commit and I see that it removed the upgrade-utils from the requirements.txt. Is that to be expected?

mkoeck avatar Nov 12 '25 07:11 mkoeck