diff --git a/muk_security/__manifest__.py b/muk_security/__manifest__.py index 0c18414..e385b20 100644 --- a/muk_security/__manifest__.py +++ b/muk_security/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Security", "summary": """Security Features""", - "version": "12.0.1.2.7", + "version": "12.0.1.2.8", "category": "Extra Tools", "license": "AGPL-3", "website": "http://www.mukit.at", diff --git a/muk_security/models/mixins_locking.py b/muk_security/models/mixins_locking.py index 520299b..a06a0b5 100644 --- a/muk_security/models/mixins_locking.py +++ b/muk_security/models/mixins_locking.py @@ -64,14 +64,15 @@ class LockingModel(models.AbstractModel): self.write({'locked_by': None}) @api.model - def _check_lock_user(self, uid): - return uid in (self.env.uid, SUPERUSER_ID) or isinstance(self.env.uid, NoSecurityUid) + def _check_lock_editor(self, lock_uid): + return lock_uid in (self.env.uid, SUPERUSER_ID) or isinstance(self.env.uid, NoSecurityUid) @api.multi - def check_lock(self, *largs, **kwargs): + def check_lock(self): for record in self: - if record.locked_by.exists() and not self._check_lock_user(record.locked_by.id): - raise AccessError(_("The record (%s [%s]) is locked, by an other user.") % (record._description, record.id)) + if record.locked_by.exists() and not self._check_lock_editor(record.locked_by.id): + message = _("The record (%s [%s]) is locked, by an other user.") + raise AccessError(message % (record._description, record.id)) #---------------------------------------------------------- # Read, View @@ -90,9 +91,9 @@ class LockingModel(models.AbstractModel): #---------------------------------------------------------- @api.multi - def write(self, vals): + def _write(self, vals): self.check_lock() - return super(BaseModelLocking, self).write(vals) + return super(BaseModelLocking, self)._write(vals) @api.multi