Browse Source

[FIX] Bug Fixed 'employee_vehicle_request'

pull/164/head
Ajmal Cybro 4 years ago
parent
commit
ae6ce290b5
  1. 2
      employee_vehicle_request/__manifest__.py
  2. 6
      employee_vehicle_request/doc/RELEASE_NOTES.md
  3. 8
      employee_vehicle_request/models/employee_fleet.py

2
employee_vehicle_request/__manifest__.py

@ -20,7 +20,7 @@
############################################################################# #############################################################################
{ {
'name': 'Employee Vehicle Request', 'name': 'Employee Vehicle Request',
'version': '14.0.1.0.0', 'version': '14.0.1.0.1',
'summary': """Manage Vehicle Requests From Employee""", 'summary': """Manage Vehicle Requests From Employee""",
'description': """This module is used for manage vehicle requests from employee. 'description': """This module is used for manage vehicle requests from employee.
This module also checking the vehicle availability at the requested time slot.""", This module also checking the vehicle availability at the requested time slot.""",

6
employee_vehicle_request/doc/RELEASE_NOTES.md

@ -3,3 +3,9 @@
#### 12.11.2020 #### 12.11.2020
#### Version 14.0.1.0.0 #### Version 14.0.1.0.0
#### ADD #### ADD
#### 24.03.2021
#### Version 14.0.1.0.1
#### FIX

8
employee_vehicle_request/models/employee_fleet.py

@ -61,6 +61,7 @@ class EmployeeFleet(models.Model):
check_availability = 0 check_availability = 0
for i in fleet_obj: for i in fleet_obj:
for each in i.reserved_time: for each in i.reserved_time:
if each.date_from and each.date_to:
if each.date_from <= self.date_from <= each.date_to: if each.date_from <= self.date_from <= each.date_to:
check_availability = 1 check_availability = 1
elif self.date_from < each.date_from: elif self.date_from < each.date_from:
@ -98,7 +99,7 @@ class EmployeeFleet(models.Model):
mail_id.mail_message_id.body = mail_content mail_id.mail_message_id.body = mail_content
mail_id.send() mail_id.send()
if self.employee.user_id: if self.employee.user_id:
mail_id.mail_message_id.write({'needaction_partner_ids': [(4, self.employee.user_id.partner_id.id)]}) # mail_id.mail_message_id.write({'notified_partner_ids': [(4, self.employee.user_id.partner_id.id)]})
mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]}) mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]})
def reject(self): def reject(self):
@ -117,7 +118,7 @@ class EmployeeFleet(models.Model):
mail_id.mail_message_id.body = mail_content mail_id.mail_message_id.body = mail_content
mail_id.send() mail_id.send()
if self.employee.user_id: if self.employee.user_id:
mail_id.mail_message_id.write({'needaction_partner_ids': [(4, self.employee.user_id.partner_id.id)]}) # mail_id.mail_message_id.write({'notified_partner_ids': [(4, self.employee.user_id.partner_id.id)]})
mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]}) mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]})
def cancel(self): def cancel(self):
@ -130,7 +131,7 @@ class EmployeeFleet(models.Model):
self.returned_date = fields.datetime.now() self.returned_date = fields.datetime.now()
self.state = 'return' self.state = 'return'
@api.constrains('date_rom', 'date_to') @api.constrains('date_from', 'date_to')
def onchange_date_to(self): def onchange_date_to(self):
for each in self: for each in self:
if each.date_from > each.date_to: if each.date_from > each.date_to:
@ -143,6 +144,7 @@ class EmployeeFleet(models.Model):
fleet_obj = self.env['fleet.vehicle'].search([]) fleet_obj = self.env['fleet.vehicle'].search([])
for i in fleet_obj: for i in fleet_obj:
for each in i.reserved_time: for each in i.reserved_time:
if each.date_from and each.date_to:
if each.date_from <= self.date_from <= each.date_to: if each.date_from <= self.date_from <= each.date_to:
i.write({'check_availability': False}) i.write({'check_availability': False})
elif self.date_from < each.date_from: elif self.date_from < each.date_from:

Loading…
Cancel
Save