Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] event: access issue for event admin to event templates #117089

Draft
wants to merge 1 commit into
base: 15.0
Choose a base branch
from

Conversation

joanna350
Copy link

@joanna350 joanna350 commented Mar 30, 2023

  1. Install Events

  2. Settings - Users

  • Ensure one has Admin:Settings, another Event:Administrator
  • Click gear icon to set password
  1. Try the step 4 with admin settings vs event admin

  2. Click on the Event app

  • [Configuration] - [Event Templates]
  • Communication tab
  • select any on Send column

Issue: It works not for Event Admin to edit the tab
Resolve by: Workaround to access ir.model
Impacted version: 15.0 - master
opw-3103199

@robodoo
Copy link
Contributor

robodoo commented Mar 30, 2023

@joanna350 joanna350 force-pushed the 15.0-opw-3103199-event-template-access-fix-hale branch from 422d22a to fe6b1e3 Compare March 30, 2023 00:48
@joanna350 joanna350 changed the title [FIX] event: irrelevant template data display [FIX] event: access issue for event admin to event templates Mar 30, 2023
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 30, 2023
@joanna350 joanna350 force-pushed the 15.0-opw-3103199-event-template-access-fix-hale branch 2 times, most recently from a58433a to cde3f8e Compare March 30, 2023 01:39
notification_model = self.notification_type.replace('_', '.') + '.template'
model = self.env[notification_model]
try:
model.search_count([('model', '=', 'event.registration')])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nle-odoo if you agree this is better than hardcoded parts in previous PRs, will update on the newly raised PRs

Copy link
Contributor

@nle-odoo nle-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok to me

this would have the same issue than the PR for event.mail, so we should see how #116469 (comment) ends before doing this.

addons/event/models/event_mail.py Outdated Show resolved Hide resolved
@joanna350 joanna350 force-pushed the 15.0-opw-3103199-event-template-access-fix-hale branch 2 times, most recently from 1ae95dd to 9fe3664 Compare March 31, 2023 03:49
1. Install Events

2. Settings - Users
- Ensure one has Admin:Settings, another Event:Administrator
- Click gear icon to set password

3. Try the step 4 with admin settings vs event admin

4. Click on the Event app
- [Configuration] - [Event Templates]
- Communication tab
- select any on Send column

Issue: It works not for Event Admin to edit the tab
Resolve by: Workaround to access ir.model
Impacted version: 15.0 - master
opw-3103199
@joanna350 joanna350 force-pushed the 15.0-opw-3103199-event-template-access-fix-hale branch from 9fe3664 to b9b09d5 Compare March 31, 2023 03:57
@@ -67,6 +69,19 @@ def _prepare_event_mail_values(self):
'template_ref': '%s,%i' % (self.template_ref._name, self.template_ref.id)
}

@api.onchange('notification_type')
def set_template_ref_model(self):
notification_model = self.template_model_id.model
Copy link
Author

@joanna350 joanna350 Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, tested this to work..do correct me if I'm wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants