Skip to content

[19.0][MIG] mail_restrict_follower_selection: Migration to 19.0#183

Open
CRogos wants to merge 36 commits into
OCA:19.0from
c4a8-odoo:copilot/migrate-mail-restrict-follower-selection
Open

[19.0][MIG] mail_restrict_follower_selection: Migration to 19.0#183
CRogos wants to merge 36 commits into
OCA:19.0from
c4a8-odoo:copilot/migrate-mail-restrict-follower-selection

Conversation

@CRogos
Copy link
Copy Markdown
Contributor

@CRogos CRogos commented Apr 16, 2026

supersede: #150

  • Fix pre-commit C8113: move mail_followers_edit.py from models/ to wizard/ directory
  • Fix test failures round 1: replace env.ref() with set_param() in tests
  • Fix safe_eval() API change: locals_dict= → positional context dict in Odoo 19.0

hbrunn and others added 30 commits April 16, 2026 15:27
Currently translated at 100.0% (3 of 3 strings)

Translation: social-11.0/social-11.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_restrict_follower_selection/fr/
Currently translated at 100.0% (3 of 3 strings)

Translation: social-11.0/social-11.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_restrict_follower_selection/de/
Currently translated at 75.0% (3 of 4 strings)

Translation: social-13.0/social-13.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_restrict_follower_selection/it/
When creating a record from a record from another model, the model is not in the context (`default_res_model` key). For example: creating an invoice from a sale order.
Currently translated at 100.0% (7 of 7 strings)

Translation: social-14.0/social-14.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_restrict_follower_selection/it/
1. Use forecreate=false in mail_restrict_follower_selection/data/ir_config_parameter.xml so that a deleted configuration is not recreated by a module update
2. Change the default domain to something less agressive
3. Add an example restriction restricting following a specific model
Currently translated at 100.0% (4 of 4 strings)

Translation: social-16.0/social-16.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_restrict_follower_selection/it/
With this is change it is now possible to use the `ref` function
in the domain set in a parameter, allowing to include xmlids
in the domain.
Kimkhoi3010 and others added 5 commits April 16, 2026 19:59
Currently translated at 100.0% (4 of 4 strings)

Translation: mail-18.0/mail-18.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_restrict_follower_selection/it/
Currently translated at 100.0% (5 of 5 strings)

Translation: mail-18.0/mail-18.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_restrict_follower_selection/it/
Currently translated at 100.0% (5 of 5 strings)

Translation: mail-18.0/mail-18.0-mail_restrict_follower_selection
Translate-URL: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_restrict_follower_selection/de/
@OCA-git-bot OCA-git-bot added series:19.0 mod:mail_restrict_follower_selection Module mail_restrict_follower_selection labels Apr 16, 2026
@CRogos CRogos marked this pull request as draft April 16, 2026 21:45
@CRogos CRogos force-pushed the copilot/migrate-mail-restrict-follower-selection branch 3 times, most recently from aac986c to 7a76706 Compare April 17, 2026 07:58
@CRogos CRogos marked this pull request as ready for review April 17, 2026 07:58
Copy link
Copy Markdown

@MohamedOsman7 MohamedOsman7 left a comment

Choose a reason for hiding this comment

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

LGTM

@MohamedOsman7
Copy link
Copy Markdown

@trisdoan can you please review this PR?

@MohamedOsman7 MohamedOsman7 mentioned this pull request May 18, 2026
34 tasks
@MohamedOsman7
Copy link
Copy Markdown

@BhaveshHeliconia could you please make a review?

Comment thread mail_restrict_follower_selection/wizard/mail_followers_edit.py Outdated
[("id", "in", wizard.partner_ids.ids)]
+ safe_eval(
domain_str,
{"ref": lambda str_id: _id_get(self.env, str_id)},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to ask the AI myself:

That lambda injects a ref() helper into safe_eval so domain expressions can resolve XML IDs safely at runtime.

In this code, safe_eval(str(domain), {"ref": lambda str_id: _id_get(self.env, str_id)}) means: when the evaluated domain contains something like ref("module.external_id"), call _id_get(self.env, str_id) and return the numeric database ID of that record. The helper itself is defined in utils.py and simply does env.ref(id_str).id, so it deliberately returns only the ID, not the recordset.

So I assume this enables you to use ref in the domain: e.g. [('industry_id','=',ref('base.res_partner_industry_A'))]

Comment thread mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py Outdated
Comment thread mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py Outdated
Comment thread mail_restrict_follower_selection/__init__.py Outdated
@@ -0,0 +1,7 @@
<?xml version="1.0" ?>
<odoo>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
<odoo>
<odoo noupdate="1">

@CRogos CRogos force-pushed the copilot/migrate-mail-restrict-follower-selection branch from 7a76706 to 2f3b290 Compare May 20, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mail_restrict_follower_selection Module mail_restrict_follower_selection series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.