mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
FIX check_company
This commit is contained in:
committed by
Jesús Alan Ramos Rodríguez
parent
0e757884ce
commit
e896dedd10
@@ -91,12 +91,12 @@ class ResUsersRoleLine(models.Model):
|
|||||||
@api.constrains('user_id', 'company_id')
|
@api.constrains('user_id', 'company_id')
|
||||||
def _check_company(self):
|
def _check_company(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
if (self.company_id and
|
if (record.company_id and
|
||||||
self.company_id != self.user_id.company_id and
|
record.company_id != record.user_id.company_id and
|
||||||
self.company_id not in self.user_id.company_ids):
|
record.company_id not in record.user_id.company_ids):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('User "{}" does not have access to the company "{}"')
|
_('User "{}" does not have access to the company "{}"')
|
||||||
.format(self.user_id.name, self.company_id.name))
|
.format(record.user_id.name, record.company_id.name))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('date_from', 'date_to')
|
@api.depends('date_from', 'date_to')
|
||||||
|
|||||||
Reference in New Issue
Block a user