diff --git a/odex25_fleet/odex_fleet/models/__pycache__/request_vehicle_authorization.cpython-38.pyc b/odex25_fleet/odex_fleet/models/__pycache__/request_vehicle_authorization.cpython-38.pyc index 48da95b81..c1f8e234a 100644 Binary files a/odex25_fleet/odex_fleet/models/__pycache__/request_vehicle_authorization.cpython-38.pyc and b/odex25_fleet/odex_fleet/models/__pycache__/request_vehicle_authorization.cpython-38.pyc differ diff --git a/odex25_fleet/odex_fleet/models/__pycache__/vehicle_deleation.cpython-38.pyc b/odex25_fleet/odex_fleet/models/__pycache__/vehicle_deleation.cpython-38.pyc index 02d4e1e9d..4063a0ed6 100644 Binary files a/odex25_fleet/odex_fleet/models/__pycache__/vehicle_deleation.cpython-38.pyc and b/odex25_fleet/odex_fleet/models/__pycache__/vehicle_deleation.cpython-38.pyc differ diff --git a/odex25_fleet/odex_fleet/models/request_vehicle_authorization.py b/odex25_fleet/odex_fleet/models/request_vehicle_authorization.py index 26577677a..7d78ed73c 100644 --- a/odex25_fleet/odex_fleet/models/request_vehicle_authorization.py +++ b/odex25_fleet/odex_fleet/models/request_vehicle_authorization.py @@ -122,8 +122,9 @@ class RequestVehicleDelegation(models.Model): rec.state = 'direct_manager' + def send_notification_to_fleet_tool_group(self): - message_template = 'عزيز {user_name} لديك طلب تفويض بحاجة الى موافقة' + message_template = 'Dear {user_name}, you have an authorization request awaiting approval' group = self.env.ref('odex_fleet.group_fleet_tool') users = group.users @@ -131,6 +132,7 @@ class RequestVehicleDelegation(models.Model): if user.partner_id: message_body = message_template.format(user_name=user.name) + # Send the notification to appear as a real notification in Odoo self.env['mail.message'].create({ 'message_type': 'notification', 'subtype_id': self.env.ref('mail.mt_comment').id, @@ -140,6 +142,10 @@ class RequestVehicleDelegation(models.Model): 'model': 'request.vehicle.authorization', 'res_id': self.id, 'author_id': self.env.user.partner_id.id, + 'notification_ids': [(0, 0, { + 'res_partner_id': user.partner_id.id, + 'notification_type': 'inbox' + })] }) def fleet_tool(self): @@ -167,9 +173,9 @@ class RequestVehicleDelegation(models.Model): vehicle = self.env['vehicle.delegation'].create(vehicle_vals) _logger.info("Created vehicle delegation: %s", vehicle) - - self.state = "fleet_tool" self.send_notification_to_fleet_tool_group() + self.state = "fleet_tool" + return vehicle diff --git a/odex25_fleet/odex_fleet/wizards/__pycache__/reject_reason.cpython-38.pyc b/odex25_fleet/odex_fleet/wizards/__pycache__/reject_reason.cpython-38.pyc index cabab3445..5d921343a 100644 Binary files a/odex25_fleet/odex_fleet/wizards/__pycache__/reject_reason.cpython-38.pyc and b/odex25_fleet/odex_fleet/wizards/__pycache__/reject_reason.cpython-38.pyc differ