blob: e0e12645c05d40634ebed74b6c116737c7ed906b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class StockLocation(models.Model):
_inherit = 'stock.location'
@api.model_create_multi
def create(self, vals_list):
if self.env.user.id not in [15, 27, 10, 2]:
raise UserError(_("Only the administrator can create new stock locations."))
return super().create(vals_list)
def write(self, vals):
if self.env.user.id not in [15, 27, 10, 2]:
raise UserError(_("Only the administrator can modify stock locations."))
return super().write(vals)
def unlink(self):
if self.env.user.id not in [15, 27, 10, 2]:
raise UserError(_("Only the administrator can delete stock locations."))
return super().unlink()
|