diff --git a/base_ux/models/res_partner.py b/base_ux/models/res_partner.py index d2189ced..eda60a0d 100644 --- a/base_ux/models/res_partner.py +++ b/base_ux/models/res_partner.py @@ -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()