[19.0][MIG] mail_restrict_follower_selection: Migration to 19.0#183
[19.0][MIG] mail_restrict_follower_selection: Migration to 19.0#183CRogos wants to merge 36 commits into
Conversation
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/
that you are not supposed to.
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.
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/
…follower selection
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/
aac986c to
7a76706
Compare
|
@trisdoan can you please review this PR? |
|
@BhaveshHeliconia could you please make a review? |
| [("id", "in", wizard.partner_ids.ids)] | ||
| + safe_eval( | ||
| domain_str, | ||
| {"ref": lambda str_id: _id_get(self.env, str_id)}, |
There was a problem hiding this comment.
What is the purpose of this?
There was a problem hiding this comment.
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'))]
| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" ?> | |||
| <odoo> | |||
There was a problem hiding this comment.
| <odoo> | |
| <odoo noupdate="1"> |
7a76706 to
2f3b290
Compare
supersede: #150
mail_followers_edit.pyfrommodels/towizard/directoryenv.ref()withset_param()in testssafe_eval()API change:locals_dict=→ positionalcontextdict in Odoo 19.0