Skip to content

Commit

Permalink
[IMP] base_ux: only internal user can be mentioned in notes
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperalta1 committed Jan 7, 2025
1 parent 4751a1d commit ece6d03
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion base_ux/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
from odoo import models, fields, api
from odoo.addons.mail.tools.discuss import Store
from odoo.osv import expression


class ResPartner(models.Model):
_inherit = 'res.partner'

active = fields.Boolean(tracking=True)

@api.model
def get_mention_suggestions(self, search, limit=8):
"""
Incluye solo usuarios internos al momento de mencionar usuarios en notas.
"""
internal_group = self.env.ref('base.group_user')
excluded_groups = [
self.env.ref('base.group_portal').id,
self.env.ref('base.group_public').id,
]
internal_users = self.env['res.users'].search([
('groups_id', 'in', internal_group.id),
('groups_id', 'not in', excluded_groups),
]).mapped('partner_id.id')
domain = self._get_mention_suggestions_domain(search)
domain = expression.AND([domain, [('id', 'in', internal_users)]])
partners = self._search_mention_suggestions(domain, limit)
return Store(partners).get_result()

0 comments on commit ece6d03

Please sign in to comment.