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 8, 2025
1 parent 4751a1d commit c7b70a6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion base_ux/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@
# 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')
internal_users = self.env['res.users'].search([
('groups_id', 'in', internal_group.id),
]).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 c7b70a6

Please sign in to comment.