From 1a43e2624db3f19b539b350280780c9048866c4d Mon Sep 17 00:00:00 2001 From: Mazen Abdo Date: Sun, 10 Nov 2024 11:26:16 +0200 Subject: [PATCH] Send the notification to appear as a real notification in Odoo --- ...quest_vehicle_authorization.cpython-38.pyc | Bin 7666 -> 7749 bytes .../vehicle_deleation.cpython-38.pyc | Bin 8979 -> 8979 bytes .../models/request_vehicle_authorization.py | 12 +++++++++--- .../__pycache__/reject_reason.cpython-38.pyc | Bin 1119 -> 1119 bytes 4 files changed, 9 insertions(+), 3 deletions(-) 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 48da95b815501332350c363a5d85686953f441cf..c1f8e234ae94f7e2116584567eee2e3e9b298d0c 100644 GIT binary patch delta 652 zcmY+HN(2;DEa9jxj-%90&rV4b z0|iP8h~FnMWgt={1}4PNftiVs&Hn-e5(`_!y$B&V=|1x5y?g%N&*GOweJvi3Nn(|| z^VWw`AN9RNY+M{mVtdbcFEI@b{y9;uo3TKtN9s{?)Ew){)rbXVyf@MZkhZd>bX6+o ztDTF>lrW>)@+hk~WRu>RHFn&VQ6t;bAdW#=e$8cehxoSZ7>sVUsOKBxHnDx%u?*5| zGIyIa_+~OV$3O%KkJ-*Gw_T7!ol&pSB+PfjXxj`Y9M`w2_Qr5j#ouYt!U+GKEFTZY z|Et)h$BU_(YFkWW0q>_SoxO`MJ0p-lfiX~J4OGx0F_6Vc{-XjhQB^@c(th!Y$s;|G z-X;4INMd_kVnWWas|18>?3Q)I&y$K7KG7C!?i5RLdABf zE?dGv7rBQN`Pa+>yycKxh=NEecTV#QdWK)mwr6%lL#UK$gfWZ~D$B&D{|4eevgb2@ z6NSn(+V(@0QR2A{JK&4C672Kc-0Ua@VG82&!`zZO{B@qs<H6n*f)o0$Uxkf$)zh?!{!)e08NFsP(2NOD#qyUaYhV(o34+b}iJTP7)fLSo5W5 zO0Dp&9^#>>{h(;UQhN3;@G`U4UVG}PcygZf;K2NNGxOftx94~NPTGsz-4;{pwlm^? z95}HXA*)LrlWOORxF1Tu68;L!KifAC0N7e&nLTF1opXgbl^}kKQ`r=!ZmE#-cq)@# z_10b45Z`1|)?M*Kg-5RVB&%{;rJcFrNPHEC;)^(T#i4A-9anD3Z538!O&nt(T-Jt7 z9CYS!%Xw<#)fadX|2Pju*J&D8!9a&DFf4^WM!-a5_5PU!evxOQ0`! z#e86JFP+O~cpX1PlTgEp=$%d)f$PK?TCpjkL}45&@jmopdu{Dz4_?OnTRU{!B;FD4 ti8f-F*rfcPmI_bQ&QUuPbd9(0bNpfWx^_$5@iD?ATB@QKhY|@GxdL1Ao*DoE 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 02d4e1e9d6b8d792c2ff5465840594ac4842da8a..4063a0ed63488ace5b33d27f69cf51d2cc4e549c 100644 GIT binary patch delta 20 acmbR2Hrb6kl$V!_0SLYZYH#G`PzC@q$OMl7 delta 20 acmbR2Hrb6kl$V!_0SIcvwKj5dC<6d59|PO~ 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 cabab3445ee5d2ac213ee8095c252baeac450c97..5d921343ae8afda35ce075f5f99941411fe2af24 100644 GIT binary patch delta 20 acmcc5ai4=bl$V!_0SLYZYH#EYVF3U((FE84 delta 20 acmcc5ai4=bl$V!_0SGQBsc+;CVF3U%t^|Sr