Skip to content

Commit 8bfc96a

Browse files
[MIG] mute_notification_user_autosubscribe: Migration to 19.0
1 parent 6981370 commit 8bfc96a

File tree

8 files changed

+58
-41
lines changed

8 files changed

+58
-41
lines changed

mute_notification_user_autosubscribe/README.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
====================================
26
Mute Notification User Autosubscribe
37
====================================
@@ -13,17 +17,17 @@ Mute Notification User Autosubscribe
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822
:alt: License: AGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
20-
:target: https://github.com/OCA/social/tree/17.0/mute_notification_user_autosubscribe
24+
:target: https://github.com/OCA/social/tree/19.0/mute_notification_user_autosubscribe
2125
:alt: OCA/social
2226
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mute_notification_user_autosubscribe
27+
:target: https://translation.odoo-community.org/projects/social-19-0/social-19-0-mute_notification_user_autosubscribe
2428
:alt: Translate me on Weblate
2529
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=19.0
2731
:alt: Try me on Runboat
2832

2933
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -88,7 +92,7 @@ Bug Tracker
8892
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
8993
In case of trouble, please check there if your issue has already been reported.
9094
If you spotted it first, help us to smash it by providing a detailed and welcomed
91-
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mute_notification_user_autosubscribe%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
95+
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mute_notification_user_autosubscribe%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
9296

9397
Do not contact contributors directly about support or help with technical issues.
9498

@@ -106,6 +110,9 @@ Contributors
106110
- Manuel Regidor <manuel.regidor@sygel.es>
107111
- Valentín Vinagre <valentin.vinagre@sygel.es>
108112
- Harald Panten <harald.panten@sygel.es>
113+
- ``Studio73 <https://www.studio73.es>``\ \_\_:
114+
115+
- Pablo Cortés
109116

110117
Maintainers
111118
-----------
@@ -120,6 +127,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
120127
mission is to support the collaborative development of Odoo features and
121128
promote its widespread use.
122129

123-
This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mute_notification_user_autosubscribe>`_ project on GitHub.
130+
This module is part of the `OCA/social <https://github.com/OCA/social/tree/19.0/mute_notification_user_autosubscribe>`_ project on GitHub.
124131

125132
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

mute_notification_user_autosubscribe/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Mute Notification User Autosubscribe",
66
"summary": "Do not send notifications to users autosubcribed through user_id field",
7-
"version": "17.0.1.0.0",
7+
"version": "19.0.1.0.0",
88
"category": "Social",
99
"website": "https://github.com/OCA/social",
1010
"author": "Sygel,Odoo Community Association (OCA)",

mute_notification_user_autosubscribe/models/res_users.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

44
from odoo import models
5+
from odoo.fields import Domain
56

67

78
class ResUsers(models.Model):
@@ -11,15 +12,15 @@ def _is_muted(self, model):
1112
self.ensure_one()
1213
muted = False
1314
user_autosubscribe_mute = self.env["user.autosubscribe.mute"].search(
14-
[("model_id", "=", model.id)], limit=1
15+
Domain("model_id", "in", [model.id]), limit=1
1516
)
1617
if user_autosubscribe_mute:
1718
groups = (
1819
",".join(user_autosubscribe_mute.group_ids.get_external_id().values())
1920
or ""
2021
)
2122
if self.id in user_autosubscribe_mute.user_ids.ids or (
22-
groups and self.user_has_groups(groups)
23+
groups and self.has_groups(groups)
2324
):
2425
muted = True
2526
return muted
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
11
# Copyright 2024 Manuel Regidor <manuel.regidor@sygel.es>
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

4-
from odoo import _, fields, models
4+
from odoo import fields, models
5+
from odoo.fields import Domain
56

67

78
class UserAutosubscribeMute(models.Model):
89
_name = "user.autosubscribe.mute"
910
_description = "User Autosubscribe Mute"
1011

1112
def _get_user_models_domain(self):
12-
models = (
13-
self.env["ir.model.fields"]
14-
.search([("name", "=", "user_id"), ("relation", "=", "res.users")])
15-
.mapped("model_id")
13+
domain = Domain("name", "in", ["user_id"]) & Domain(
14+
"relation", "in", ["res.users"]
1615
)
17-
return f"[('id', 'in', {models.ids})]"
16+
user_models = self.env["ir.model.fields"].search(domain).mapped("model_id")
17+
return Domain("id", "in", user_models.ids)
1818

1919
name = fields.Char(required=True)
2020
active = fields.Boolean(default=True)
2121
model_id = fields.Many2one(
2222
comodel_name="ir.model",
23-
domain=_get_user_models_domain,
23+
domain=lambda self: self._get_user_models_domain(),
2424
ondelete="cascade",
2525
required=True,
2626
)
2727
user_ids = fields.Many2many(comodel_name="res.users", string="Users")
2828
group_ids = fields.Many2many(comodel_name="res.groups", string="Groups")
2929
notes = fields.Text()
3030

31-
_sql_constraints = [
32-
(
33-
"unique_model_id",
34-
"UNIQUE(model_id)",
35-
_("Model must be unique in User Autosubscribe Mute instances."),
36-
)
37-
]
31+
_unique_model = models.Constraint(
32+
"unique(model_id)", "Model must be unique in User Autosubscribe Mute instances."
33+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
- Manuel Regidor \<<manuel.regidor@sygel.es>\>
22
- Valentín Vinagre \<<valentin.vinagre@sygel.es>\>
33
- Harald Panten \<<harald.panten@sygel.es>\>
4+
- `Studio73 <https://www.studio73.es>`__:
5+
- Pablo Cortés

mute_notification_user_autosubscribe/static/description/index.html

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Mute Notification User Autosubscribe</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,16 +360,21 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="mute-notification-user-autosubscribe">
364-
<h1 class="title">Mute Notification User Autosubscribe</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="mute-notification-user-autosubscribe">
370+
<h1>Mute Notification User Autosubscribe</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:7fd69709f8165af1b208813a1d6b358d2829c695b43a94f20ead96158724c68e
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mute_notification_user_autosubscribe"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mute_notification_user_autosubscribe"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/19.0/mute_notification_user_autosubscribe"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-19-0/social-19-0-mute_notification_user_autosubscribe"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373378
<p>This module allows to select users and/or groups whose members do not
374379
have to be sent notifications through the chatter. The models in which
375380
these rules have to be applied can also be selected.</p>
@@ -389,7 +394,7 @@ <h1 class="title">Mute Notification User Autosubscribe</h1>
389394
</ul>
390395
</div>
391396
<div class="section" id="configuration">
392-
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
397+
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
393398
<p>To configure this module you need to:</p>
394399
<ul class="simple">
395400
<li>Go to Settings &gt; Technical &gt; Auto Subscribe Mute</li>
@@ -419,58 +424,63 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
419424
</ul>
420425
</div>
421426
<div class="section" id="usage">
422-
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
427+
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
423428
<p>In case a user that has been automatically applied the “Mute” message
424429
subtype in a subscription through one of the rules provided in this
425430
module needs to be sent notifications in a specific document, just edit
426431
the subscription and select the subtypes for which the user has to be
427432
sent notifications.</p>
428433
</div>
429434
<div class="section" id="known-issues-roadmap">
430-
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
435+
<h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
431436
<ul class="simple">
432437
<li>If a and “Auto Subscribe Mute” rule is modified, created or deleted,
433438
changes will not affect existing documents, so their users subtypes
434439
will keep the current configuration.</li>
435440
</ul>
436441
</div>
437442
<div class="section" id="bug-tracker">
438-
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
443+
<h2><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h2>
439444
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
440445
In case of trouble, please check there if your issue has already been reported.
441446
If you spotted it first, help us to smash it by providing a detailed and welcomed
442-
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mute_notification_user_autosubscribe%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
447+
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mute_notification_user_autosubscribe%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
443448
<p>Do not contact contributors directly about support or help with technical issues.</p>
444449
</div>
445450
<div class="section" id="credits">
446-
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
451+
<h2><a class="toc-backref" href="#toc-entry-5">Credits</a></h2>
447452
<div class="section" id="authors">
448-
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
453+
<h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
449454
<ul class="simple">
450455
<li>Sygel</li>
451456
</ul>
452457
</div>
453458
<div class="section" id="contributors">
454-
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
459+
<h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
455460
<ul class="simple">
456461
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
457462
<li>Valentín Vinagre &lt;<a class="reference external" href="mailto:valentin.vinagre&#64;sygel.es">valentin.vinagre&#64;sygel.es</a>&gt;</li>
458463
<li>Harald Panten &lt;<a class="reference external" href="mailto:harald.panten&#64;sygel.es">harald.panten&#64;sygel.es</a>&gt;</li>
464+
<li><tt class="docutils literal">Studio73 <span class="pre">&lt;https://www.studio73.es&gt;</span></tt>__:<ul>
465+
<li>Pablo Cortés</li>
466+
</ul>
467+
</li>
459468
</ul>
460469
</div>
461470
<div class="section" id="maintainers">
462-
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
471+
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
463472
<p>This module is maintained by the OCA.</p>
464473
<a class="reference external image-reference" href="https://odoo-community.org">
465474
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
466475
</a>
467476
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
468477
mission is to support the collaborative development of Odoo features and
469478
promote its widespread use.</p>
470-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mute_notification_user_autosubscribe">OCA/social</a> project on GitHub.</p>
479+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/19.0/mute_notification_user_autosubscribe">OCA/social</a> project on GitHub.</p>
471480
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
472481
</div>
473482
</div>
474483
</div>
484+
</div>
475485
</body>
476486
</html>

mute_notification_user_autosubscribe/views/user_autosubscribe_mute_views.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,21 @@
4949
</field>
5050
</record>
5151
<record id="user_autosubscribe_mute_tree_view" model="ir.ui.view">
52-
<field name="name">user.autosubscribe.mute.tree.view</field>
52+
<field name="name">user.autosubscribe.mute.list.view</field>
5353
<field name="model">user.autosubscribe.mute</field>
5454
<field name="arch" type="xml">
55-
<tree>
55+
<list>
5656
<field name="name" />
5757
<field name="model_id" />
5858
<field name="user_ids" />
5959
<field name="group_ids" />
60-
</tree>
60+
</list>
6161
</field>
6262
</record>
6363
<record id="user_autosubscribe_mute_action" model="ir.actions.act_window">
6464
<field name="name">User Autosubscribe Mute</field>
6565
<field name="res_model">user.autosubscribe.mute</field>
66-
<field name="view_mode">tree,form</field>
66+
<field name="view_mode">list,form</field>
6767
</record>
6868
<menuitem
6969
parent="mail.mail_menu_technical"

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
odoo==19.0.*

0 commit comments

Comments
 (0)