Commit e65217a8 by Arturo Jasso Origel

se arreglo un bug al momento de intentar darle acceso al usuario de portal de mantenimiento

parent 74ee5e96
from odoo import models, fields, api, _ from odoo import models, fields, api, _
from odoo.exceptions import UserError,ValidationError from odoo.exceptions import UserError,ValidationError
import logging
_logger = logging.getLogger(__name__)
class ResUsersInherit(models.Model): class ResUsersInherit(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
...@@ -32,7 +38,13 @@ class ResUsersInherit(models.Model): ...@@ -32,7 +38,13 @@ class ResUsersInherit(models.Model):
def no_create_user_maintenance(self): def no_create_user_maintenance(self):
if self.is_maintenance == True: if self.is_maintenance == True:
users = self.search([('warehouse_id','=',self.warehouse.id),('is_maintenance','=',True),('maintenance_position','=',self.maintenance_position)]) users = self.search([
('warehouse_id','=',self.warehouse_id.id),
('is_maintenance','=',True),
('maintenance_position','=',self.maintenance_position),
('id','!=',self.id)
])
_logger.info(users)
if len(users) == 0: if len(users) == 0:
return True return True
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment