27 lines
744 B
Python
27 lines
744 B
Python
# -*- coding: utf-8 -*-
|
|
import random
|
|
from odoo import models, fields, api
|
|
from odoo.http import request
|
|
from odoo.exceptions import AccessDenied
|
|
|
|
import logging
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ResUsers(models.Model):
|
|
_inherit = 'res.users'
|
|
|
|
we_employee_id = fields.Char(string=u'企业微信账号', default="")
|
|
|
|
def _check_credentials(self, we_employee_id, env):
|
|
"""
|
|
用户验证
|
|
"""
|
|
try:
|
|
return super(ResUsers, self)._check_credentials(we_employee_id, env)
|
|
except AccessDenied:
|
|
user_id = self.env['res.users'].sudo().search([('we_employee_id', '=', we_employee_id)])
|
|
if not (user_id and user_id.id == self.env.uid):
|
|
raise
|