summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-01-26 12:11:12 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-01-26 12:11:12 +0700
commita136db83129f0f428c5baf600e8f1ed35fdcca08 (patch)
treef56b859588509582b874d45b76e072cf81fcbb14
parenta9ac4073cf6c42f59973c4f0c3ce730464dd41ec (diff)
<Miqdad> add permission stock locations
-rwxr-xr-xfixco_custom/models/__init__.py3
-rw-r--r--fixco_custom/models/stock_location.py21
2 files changed, 23 insertions, 1 deletions
diff --git a/fixco_custom/models/__init__.py b/fixco_custom/models/__init__.py
index de92dc0..f7559c8 100755
--- a/fixco_custom/models/__init__.py
+++ b/fixco_custom/models/__init__.py
@@ -39,4 +39,5 @@ from . import upload_cancel_picking
from . import product_supplierinfo
from . import queue_job
from . import purchase_order_multi_bills
-from . import account_payment \ No newline at end of file
+from . import account_payment
+from . import stock_location \ No newline at end of file
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()