Skip to content

[17.0][ADD] mail_template_domain: New module#176

Open
cristina-hidalgo-tecnativa wants to merge 1 commit intoOCA:17.0from
Tecnativa:17.0-add-mail_template_domain
Open

[17.0][ADD] mail_template_domain: New module#176
cristina-hidalgo-tecnativa wants to merge 1 commit intoOCA:17.0from
Tecnativa:17.0-add-mail_template_domain

Conversation

@cristina-hidalgo-tecnativa
Copy link
Copy Markdown

This module adds a domain filter field on mail templates so only templates matching the active record appear in the email composer dropdown.

@Tecnativa TT61914
@pedrobaeza @victoralmau

@OCA-git-bot OCA-git-bot added mod:mail_template_domain Module mail_template_domain series:17.0 labels Apr 15, 2026
@pedrobaeza pedrobaeza added this to the 17.0 milestone Apr 15, 2026
Comment thread mail_template_domain/models/mail_compose_message.py Outdated
)

@api.model
def _name_search(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why overriding this one instead of search / _search. This one is partial. You should also put a comment as first line explaining why you override the method.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

_name_search is the entry point for Many2one widget lookups. The filter needs Python-side evaluation via filtered_domain() against the actual records, so it can't be pushed down to SQL. Overriding search/_search would apply it to all search paths (list views, programmatic calls), which is not the intended behaviour — fail-open outside the composer context is by design.

@pedrobaeza
Copy link
Copy Markdown
Member

I think you can use _evaluate_res_ids for getting the involved records.

@cristina-hidalgo-tecnativa cristina-hidalgo-tecnativa force-pushed the 17.0-add-mail_template_domain branch from 39f7f44 to d22b054 Compare April 15, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mail_template_domain Module mail_template_domain series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants