Merge pull request #5218 from expsa/maz_dms_security_inherit

fix dms_security_inherit
This commit is contained in:
mazenmuhamad 2025-11-04 16:52:11 +02:00 committed by GitHub
commit 6bb9cce275
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1 @@
from . import models

View File

@ -0,0 +1,16 @@
{
'name': 'DMS Security Inherit',
'version': '1.0',
'author': '',
'website': '',
'license': 'LGPL-3',
'depends': ['dms','documents','base'],
'data': [
'security/security.xml',
],
'installable': True,
'application': False,
'auto_install': False,
}

View File

@ -0,0 +1 @@
from . import model

View File

@ -0,0 +1,15 @@
from odoo import models, api, _
from odoo.exceptions import AccessError
class DocumentsDocument(models.Model):
_inherit = 'documents.document'
@api.model_create_multi
def create(self, vals_list):
if not self.env.su:
if not self.env.user.has_group('dms.group_dms_manager'):
raise AccessError(
_("You don't have permission to create new documents. Only DMS Managers can upload new files.")
)
return super(DocumentsDocument, self).create(vals_list)

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<delete model="ir.rule" id="dms.rule_directory_computed_write"/>
</data>
</odoo>