odex25_standard/odex25_dms/dms_security_inherit/models/model.py

15 lines
540 B
Python

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)