feat: grant portal access to app notifications, adjust image dimensions, fix controller base64 encoding, and close wizard on success

This commit is contained in:
Suherdy Yacob 2026-06-13 22:27:39 +07:00
parent e7685c38c8
commit d9a4b14a49
4 changed files with 5 additions and 3 deletions

View File

@ -54,7 +54,7 @@ class AppNotificationController(http.Controller):
for notif in notifications: for notif in notifications:
img = notif.get('image_128') img = notif.get('image_128')
if img and isinstance(img, bytes): if img and isinstance(img, bytes):
notif['image_128'] = b64mod.b64encode(img).decode('utf-8') notif['image_128'] = img.decode('utf-8')
elif not img: elif not img:
notif['image_128'] = None notif['image_128'] = None
notif['has_image'] = bool(notif['image_128']) notif['has_image'] = bool(notif['image_128'])

View File

@ -11,8 +11,8 @@ class AppNotification(models.Model):
# Optional promotional image — Odoo auto-generates image_128 thumbnail # Optional promotional image — Odoo auto-generates image_128 thumbnail
image = fields.Image( image = fields.Image(
string='Notification Image', string='Notification Image',
max_width=1920, max_width=1024,
max_height=1920, max_height=1024,
help='Optional image shown in the notification detail screen.' help='Optional image shown in the notification detail screen.'
) )
image_128 = fields.Image( image_128 = fields.Image(

View File

@ -2,6 +2,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mapan_push_wizard_manager,mapan_push_wizard_manager,model_mapan_push_wizard,mapan_loyalty_push.group_mapan_loyalty_push_manager,1,1,1,1 access_mapan_push_wizard_manager,mapan_push_wizard_manager,model_mapan_push_wizard,mapan_loyalty_push.group_mapan_loyalty_push_manager,1,1,1,1
access_mapan_app_notification_user,mapan_app_notification_user,model_mapan_app_notification,mapan_loyalty_push.group_mapan_loyalty_push_user,1,0,0,0 access_mapan_app_notification_user,mapan_app_notification_user,model_mapan_app_notification,mapan_loyalty_push.group_mapan_loyalty_push_user,1,0,0,0
access_mapan_app_notification_manager,mapan_app_notification_manager,model_mapan_app_notification,mapan_loyalty_push.group_mapan_loyalty_push_manager,1,1,1,1 access_mapan_app_notification_manager,mapan_app_notification_manager,model_mapan_app_notification,mapan_loyalty_push.group_mapan_loyalty_push_manager,1,1,1,1
access_mapan_app_notification_portal,mapan_app_notification_portal,model_mapan_app_notification,base.group_portal,1,0,0,0
access_loyalty_card_portal,loyalty.card.portal,loyalty.model_loyalty_card,base.group_portal,1,0,0,0 access_loyalty_card_portal,loyalty.card.portal,loyalty.model_loyalty_card,base.group_portal,1,0,0,0
access_loyalty_program_portal,loyalty.program.portal,loyalty.model_loyalty_program,base.group_portal,1,0,0,0 access_loyalty_program_portal,loyalty.program.portal,loyalty.model_loyalty_program,base.group_portal,1,0,0,0
access_loyalty_history_portal,loyalty.history.portal,loyalty.model_loyalty_history,base.group_portal,1,0,0,0 access_loyalty_history_portal,loyalty.history.portal,loyalty.model_loyalty_history,base.group_portal,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mapan_push_wizard_manager mapan_push_wizard_manager model_mapan_push_wizard mapan_loyalty_push.group_mapan_loyalty_push_manager 1 1 1 1
3 access_mapan_app_notification_user mapan_app_notification_user model_mapan_app_notification mapan_loyalty_push.group_mapan_loyalty_push_user 1 0 0 0
4 access_mapan_app_notification_manager mapan_app_notification_manager model_mapan_app_notification mapan_loyalty_push.group_mapan_loyalty_push_manager 1 1 1 1
5 access_mapan_app_notification_portal mapan_app_notification_portal model_mapan_app_notification base.group_portal 1 0 0 0
6 access_loyalty_card_portal loyalty.card.portal loyalty.model_loyalty_card base.group_portal 1 0 0 0
7 access_loyalty_program_portal loyalty.program.portal loyalty.model_loyalty_program base.group_portal 1 0 0 0
8 access_loyalty_history_portal loyalty.history.portal loyalty.model_loyalty_history base.group_portal 1 0 0 0

View File

@ -53,5 +53,6 @@ class PushNotificationWizard(models.TransientModel):
'message': f'Notification staged for {target_msg}.', 'message': f'Notification staged for {target_msg}.',
'type': 'success', 'type': 'success',
'sticky': False, 'sticky': False,
'next': {'type': 'ir.actions.act_window_close'},
} }
} }