Merge pull request #1697 from expsa/zen_request_vehicle

fix2 Department Manager
This commit is contained in:
mazenmuhamad 2024-11-06 13:01:58 +02:00 committed by GitHub
commit 52f418397d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 9 additions and 8 deletions

View File

@ -49,7 +49,7 @@ class RequestVehicleDelegation(models.Model):
last_branch_id = fields.Many2one('hr.department', string="Last Branch", compute="get_last_branch", store=True,help='The last Branch the vehicle was authorized for',tracking=True)
from_hr_depart = fields.Boolean()
name = fields.Char(string="Name")
department_id= fields.Many2one('hr.department')
depart_id= fields.Many2one('hr.department')
@ -120,7 +120,7 @@ class RequestVehicleDelegation(models.Model):
def direct_manager(self):
for rec in self:
rec.state = 'direct_manager'
rec.send_notification_to_fleet_tool_group()
def send_notification_to_fleet_tool_group(self):
message_template = 'عزيز {user_name} لديك طلب تفويض بحاجة الى موافقة'
@ -135,7 +135,7 @@ class RequestVehicleDelegation(models.Model):
'message_type': 'notification',
'subtype_id': self.env.ref('mail.mt_comment').id,
'body': message_body,
'subject': 'طلب تفويض جديد',
'subject': 'New authorization request',
'partner_ids': [(4, user.partner_id.id)],
'model': 'request.vehicle.authorization',
'res_id': self.id,
@ -160,7 +160,7 @@ class RequestVehicleDelegation(models.Model):
'last_project_id': self.last_project_id.id if self.last_project_id else False,
'last_branch_id': self.last_branch_id.id,
'custody_id': self.custody_id.id if self.custody_id else False,
'department_id': self.department_id.id if self.department_id else False,
'depart_id': self.depart_id.id if self.depart_id else False,
'request_vehicle_authorization': self.id
}
_logger.info("Attempting to create vehicle delegation with values: %s", vehicle_vals)
@ -169,6 +169,7 @@ class RequestVehicleDelegation(models.Model):
_logger.info("Created vehicle delegation: %s", vehicle)
self.state = "fleet_tool"
self.send_notification_to_fleet_tool_group()
return vehicle

View File

@ -52,7 +52,7 @@ class VehicleDelegation(models.Model):
last_department_id = fields.Many2one(related='vehicle_id.department_id', string="Last Department",help='The last Department the vehicle was authorized for')
last_project_id = fields.Many2one('project.project', string='Last Project', compute="get_last_project", store=True)
last_branch_id = fields.Many2one('hr.department', string="Last Branch", compute="get_last_branch", store=True,help='The last Branch the vehicle was authorized for')
depart_id= fields.Many2one('hr.department')
@api.depends("vehicle_id")
def get_first_odometer(self):
for rec in self :

View File

@ -39,7 +39,7 @@
<field name="license_number" readonly="1" force_save="1"/>
<field name="license_end" readonly="1" force_save="1"/>
<!-- <field name="custody_id" invisible="1"/>-->
<field name="department_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="depart_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</group>
<div class="oe_title">
<label for="vehicle_id" class="oe_edit_only"/>
@ -84,7 +84,7 @@
<tree>
<field name="employee_id"/>
<field name="vehicle_id"/>
<field name="department_id"/>
<field name="depart_id"/>
</tree>
</field>

View File

@ -48,7 +48,7 @@
<field name="license_number" readonly="1" force_save="1"/>
<field name="license_end" readonly="1" force_save="1"/>
<field name="custody_id" invisible="1"/>
<field name="departments_id" attrs="{'invisible': [('departments_id', '=', False)]}"/>
<field name="depart_id" attrs="{'invisible': [('departments_id', '=', False)]}"/>
</group>
<group col="4" colspan="2" string="delegated entity" attrs="{'invisible': [('delegation_type', '!=', 'branch')]}">
<!-- <field name="state_id" attrs="{'readonly': [('state', '!=', 'draft')],'required':[('delegation_type', '=', 'branch')]}" />-->