diff --git a/ext/custom-addons/dp_custom/__manifest__.py b/ext/custom-addons/dp_custom/__manifest__.py index 53c3eef9..22295244 100644 --- a/ext/custom-addons/dp_custom/__manifest__.py +++ b/ext/custom-addons/dp_custom/__manifest__.py @@ -37,6 +37,7 @@ 'dp_intercompany_invoicing', ], 'data': [ + 'security/security.xml', 'data/dp_custom_data.xml', 'data/glaser_company_data.xml', 'data/tz_austria_company_data.xml', diff --git a/ext/custom-addons/dp_custom/data/glaser_company_data.xml b/ext/custom-addons/dp_custom/data/glaser_company_data.xml index ef3bc767..b5d12075 100644 --- a/ext/custom-addons/dp_custom/data/glaser_company_data.xml +++ b/ext/custom-addons/dp_custom/data/glaser_company_data.xml @@ -38,7 +38,8 @@ (4,ref('base.group_partner_manager')), (4,ref('account.group_account_user')), (4,ref('website.group_website_designer')), - (4,ref('queue_job.group_queue_job_manager'))]"/> + (4,ref('queue_job.group_queue_job_manager')), + (4,ref('dp_custom.group_allow_delete_so_attachments'))]"/> diff --git a/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml b/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml index 50c44955..4da4b591 100644 --- a/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml +++ b/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml @@ -14,7 +14,8 @@ (4,ref('base.group_partner_manager')), (4,ref('account.group_account_user')), (4,ref('website.group_website_designer')), - (4,ref('queue_job.group_queue_job_manager'))]"/> + (4,ref('queue_job.group_queue_job_manager')), + (4,ref('dp_custom.group_allow_delete_so_attachments'))]"/> diff --git a/ext/custom-addons/dp_custom/models/ir_attachment.py b/ext/custom-addons/dp_custom/models/ir_attachment.py index 5f0cc232..2c382102 100644 --- a/ext/custom-addons/dp_custom/models/ir_attachment.py +++ b/ext/custom-addons/dp_custom/models/ir_attachment.py @@ -30,7 +30,7 @@ class Attachment(models.Model): @api.multi def write(self, vals): for record in self: - if record.from_designbox: + if record.from_designbox and not self.env.user.has_group('dp_custom.group_allow_delete_so_attachments'): raise ValidationError( _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) @@ -39,7 +39,7 @@ class Attachment(models.Model): @api.multi def unlink(self): for record in self: - if record.from_designbox: + if record.from_designbox and not self.env.user.has_group('dp_custom.group_allow_delete_so_attachments'): raise ValidationError( _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) diff --git a/ext/custom-addons/dp_custom/security/security.xml b/ext/custom-addons/dp_custom/security/security.xml new file mode 100644 index 00000000..36d02e80 --- /dev/null +++ b/ext/custom-addons/dp_custom/security/security.xml @@ -0,0 +1,8 @@ + + + + Löschen von Anhängen in Angeboten erlauben + + Löschen von Anhängen in Angeboten erlauben + +