Browse Source

FIX check_company

pull/1489/head
Pierrick Brun 6 years ago
parent
commit
7460424209
  1. 8
      base_user_role/models/role.py

8
base_user_role/models/role.py

@ -82,12 +82,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