Browse Source

FIX check_company

14.0
Pierrick Brun 6 years ago
committed by Jesús Alan Ramos Rodríguez
parent
commit
e896dedd10
  1. 8
      base_user_role/models/role.py

8
base_user_role/models/role.py

@ -91,12 +91,12 @@ class ResUsersRoleLine(models.Model):
@api.constrains('user_id', 'company_id')
def _check_company(self):
for record in self:
if (self.company_id and
self.company_id != self.user_id.company_id and
self.company_id not in self.user_id.company_ids):
if (record.company_id and
record.company_id != record.user_id.company_id and
record.company_id not in record.user_id.company_ids):
raise ValidationError(
_('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.depends('date_from', 'date_to')

Loading…
Cancel
Save