-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] portal_backend: enable to create and edit attachments
- Loading branch information
1 parent
f568827
commit 374e42d
Showing
4 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from odoo import http, _ | ||
from odoo.exceptions import UserError | ||
from odoo.http import request | ||
|
||
from odoo.addons.mail.controllers.discuss import DiscussController | ||
|
||
|
||
class PortalBackendDiscussController(DiscussController): | ||
|
||
@http.route('/mail/attachment/delete', methods=['POST'], type='json', auth='public') | ||
def mail_attachment_delete(self, attachment_id, access_token=None, **kwargs): | ||
if request.env.user.has_group('portal_backend.group_portal_backend'): | ||
raise UserError(_("You are not allowed to remove attachments")) | ||
return super().mail_attachment_delete(attachment_id, access_token=access_token, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters