diff --git a/odex25_dms/dms/i18n/ar_001.po b/odex25_dms/dms/i18n/ar_001.po
index 6848ec65c..098d9ebd6 100644
--- a/odex25_dms/dms/i18n/ar_001.po
+++ b/odex25_dms/dms/i18n/ar_001.po
@@ -2694,6 +2694,11 @@ msgstr "مسار جيسون"
msgid "Path Names"
msgstr "اسم المسار"
+#. module: dms
+#: model:res.groups,name:dms.group_dms_delete_file
+msgid "Permission to delete Files"
+msgstr "صلاحية حذف الملفات"
+
#. module: dms
#: model:res.groups,name:dms.group_dms_delete_directory
msgid "Permission to delete Folders/Directories"
@@ -3571,6 +3576,12 @@ msgstr "امكانية التعديل "
msgid "Write a tooltip for the action here"
msgstr "اكتب تلميحًا للإجراء هنا"
+#. module: dms
+#: code:addons/dms/models/document.py:0
+#, python-format
+msgid "You are not allowed to delete a file!"
+msgstr "ليس مسموح لك بحذف ملف!"
+
#. module: dms
#: code:addons/dms/models/directory.py:0
#, python-format
diff --git a/odex25_dms/dms/models/document.py b/odex25_dms/dms/models/document.py
index 7b653dff4..980612f4d 100644
--- a/odex25_dms/dms/models/document.py
+++ b/odex25_dms/dms/models/document.py
@@ -695,6 +695,13 @@ class Document(models.Model):
self.mapped('attachment_id').write(attachment_dict)
return write_result
+
+ def unlink(self):
+ if not self.env.user.has_group("dms.group_dms_delete_file") and not self.env.user.id == 1:
+ raise ValidationError(
+ _("You are not allowed to delete a file!")
+ )
+ return super(Document, self).unlink()
def _process_activities(self, attachment_id):
self.ensure_one()
diff --git a/odex25_dms/dms/security/security.xml b/odex25_dms/dms/security/security.xml
index e68f81189..d8996f41e 100644
--- a/odex25_dms/dms/security/security.xml
+++ b/odex25_dms/dms/security/security.xml
@@ -33,6 +33,9 @@
+
+ Permission to delete Files
+
Permission to delete Folders/Directories