Files
odoo_source/addons/website_slides/models/res_groups.py
T
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00

17 lines
589 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class UserGroup(models.Model):
_inherit = 'res.groups'
def write(self, vals):
""" Automatically subscribe new users to linked slide channels """
write_res = super(UserGroup, self).write(vals)
if vals.get('users'):
# TDE FIXME: maybe directly check users and subscribe them
self.env['slide.channel'].sudo().search([('enroll_group_ids', 'in', self._ids)])._add_groups_members()
return write_res