diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-28 15:27:31 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-28 15:27:31 +0700 |
| commit | e9b9be0af8edef9b3ae26143c1783870e099d262 (patch) | |
| tree | 79b0e90f2e7b9f5bc9f43aa9aab4ef5b4f84852c /fixco_custom/models/stock_location.py | |
| parent | 7fd85b36543e6f1cc9e55a90bbee2743ca129d5f (diff) | |
| parent | 87abb539133d4f97c8a9cb9708a472c00a64e069 (diff) | |
Merge branch 'main' of bitbucket.org:altafixco/fixco-addons
pull
Diffstat (limited to 'fixco_custom/models/stock_location.py')
| -rw-r--r-- | fixco_custom/models/stock_location.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fixco_custom/models/stock_location.py b/fixco_custom/models/stock_location.py new file mode 100644 index 0000000..e0e1264 --- /dev/null +++ b/fixco_custom/models/stock_location.py @@ -0,0 +1,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() |
