@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Vehicle Inspection Management in Fleet |
|||
====================================== |
|||
* Vehicle Inspection Management in Fleet |
|||
|
|||
Configuration |
|||
============= |
|||
* From the user set the vehicle inspection management |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: |
|||
(V16) Vishnu P |
|||
(V17) Anjhana A K |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit https://www.cybrosys.com |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
|||
from . import wizards |
@ -0,0 +1,56 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Vehicle Inspection Management in Fleet', |
|||
'version': '17.0.1.0.0', |
|||
'category': 'Industries', |
|||
'summary': """Vehicle Inspection Management for managing the Vehicle |
|||
Inspection and services""", |
|||
'description': """Efficiently organize and oversee vehicle inspections and |
|||
services with Vehicle Inspection Management system in Odoo, ensuring |
|||
optimal functionality and maintenance""", |
|||
'depends': ['base', 'fleet'], |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'images': ['static/description/banner.jpg'], |
|||
'website': 'https://www.cybrosys.com', |
|||
'data': { |
|||
'security/vehicle_inspection_access.xml', |
|||
'security/vehicle_inspection_management_security.xml', |
|||
'security/ir.model.access.csv', |
|||
'data/ir_sequence_data.xml', |
|||
'data/ir_cron_data.xml', |
|||
'data/mail_template_data.xml', |
|||
'views/vehicle_inspection_views.xml', |
|||
'views/inspection_request_views.xml', |
|||
'wizards/fleet_service_inspection_views.xml', |
|||
'views/fleet_vehicle_views.xml', |
|||
'views/fleet_vehicle_log_services_views.xml', |
|||
'views/vehicle_service_log_views.xml', |
|||
'reports/vehicle_inspection_reports.xml', |
|||
'reports/vehicle_inspection_report_templates.xml', |
|||
}, |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,18 @@ |
|||
<?xml version='1.0' encoding='utf-8'?> |
|||
<odoo> |
|||
<!-- cron function to create inspection request--> |
|||
<data noupdate="1"> |
|||
<record id="ir_cron_scheduler_inspection_request" model="ir.cron"> |
|||
<field name="name">Vehicle inspection Request</field> |
|||
<field name="model_id" ref="model_inspection_request"/> |
|||
<field name="state">code</field> |
|||
<field name="code">model.action_create_inspection_request() |
|||
</field> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">days</field> |
|||
<field name="numbercall">-1</field> |
|||
<field name="doall">1</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inspection request sequence--> |
|||
<data noupdate="1"> |
|||
<record id="sequence_inspection_request" model="ir.sequence"> |
|||
<field name="name">Vehicle Inspection Request</field> |
|||
<field name="code">inspection.request</field> |
|||
<field name="prefix">INSPECTION/REQUEST</field> |
|||
<field name="padding">5</field> |
|||
<field eval="1" name="number_next"/> |
|||
<field eval="1" name="number_increment"/> |
|||
<field eval="False" name="company_id"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Template for vehicle inspection reminder email--> |
|||
<data noupdate="1"> |
|||
<record id="vehicle_inspection_reminder_email_template" |
|||
model="mail.template"> |
|||
<field name="name">Vehicle Inspection Notification Email</field> |
|||
<field name="email_from">{{object.user_id.company_id.email}} |
|||
</field> |
|||
<field name="subject">{{object.name}} - |
|||
{{object.inspection_id.name}} |
|||
</field> |
|||
<field name="model_id" |
|||
ref="fleet_vehicle_inspection_management.model_inspection_request"/> |
|||
<field name="email_to">{{object.user_id.email}}</field> |
|||
<field name="auto_delete" eval="True"/> |
|||
<field name="body_html" type="html"> |
|||
<p>Dear<t t-out="object.user_id.name"/>, |
|||
</p> |
|||
<ul>This Email is about Vehicle Inspection Notification as |
|||
below: |
|||
<t t-out="object.inspection_date"/> |
|||
<br/> |
|||
<table border="1"> |
|||
<thead> |
|||
<tr> |
|||
<th width="200">Vehicle</th> |
|||
<th width="200">Model</th> |
|||
<th width="200">License Plate</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td width="200"> |
|||
<t t-out="object.vehicle_id.name"/> |
|||
</td> |
|||
<td width="200"> |
|||
<t t-out="object.vehicle_model_id.name"/> |
|||
</td> |
|||
<td width="200"> |
|||
<t t-out="object.license_plate"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<br/> |
|||
<br/> |
|||
<p/> |
|||
</ul> |
|||
<font size="3"> |
|||
<p>Thank you,</p> |
|||
</font> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <fleet_vehicle_inspection_management> |
|||
|
|||
#### 11.01.2024 |
|||
#### Version 17.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Vehicle Inspection Management in Fleet |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import vehicle_inspection |
|||
from . import inspection_request |
|||
from . import inspection_images |
|||
from . import fleet_vehicle |
|||
from . import inspection_request_line |
|||
from . import vehicle_service_log |
@ -0,0 +1,89 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class FleetVehicleInherit(models.Model): |
|||
""" inherit model and add inspection lines""" |
|||
_inherit = 'fleet.vehicle' |
|||
|
|||
inspection_line_ids = fields.One2many('inspection.request.line', |
|||
'fleet_vehicle_id', |
|||
string='Inspection Line', |
|||
help='Vehicle Inspection Lines') |
|||
is_inspection_active = fields.Boolean(string='Inspection active', |
|||
help='Active Vehicle Inspection', |
|||
default=False) |
|||
inspection_count = fields.Integer(string='Inspections', |
|||
help='Number of inspections', |
|||
compute='_compute_inspection_count') |
|||
|
|||
def get_inspection_requests(self): |
|||
"""Inspection smart button""" |
|||
self.ensure_one() |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'name': 'Vehicle Inspections', |
|||
'view_mode': 'tree,form', |
|||
'res_model': 'inspection.request', |
|||
'domain': [('vehicle_id', '=', self.id)], |
|||
} |
|||
|
|||
@api.depends('is_inspection_active') |
|||
def _compute_inspection_count(self): |
|||
""" calculating the vehicle inspection number """ |
|||
self.inspection_count = self.env['inspection.request'].search_count( |
|||
[('vehicle_id', '=', self.id)]) |
|||
|
|||
|
|||
class FleetVehicleLogServicesInherit(models.Model): |
|||
"""inherit fleet service add sub service types""" |
|||
_inherit = 'fleet.vehicle.log.services' |
|||
|
|||
fleet_service_id = fields.Many2one( |
|||
'fleet.vehicle.log.services', |
|||
help='Fleet service', string='Fleet service') |
|||
sub_service_ids = fields.One2many('fleet.service.inspection', |
|||
'service_id', |
|||
help='Sub Service Lines', |
|||
string='Sub Service Lines') |
|||
inspection_reference = fields.Integer(string='Inspection Reference', |
|||
help='Inspection Reference') |
|||
inspection_name = fields.Char(string='Inspection', |
|||
help='Vehicle Inspection name') |
|||
|
|||
|
|||
class FleetSubServiceTypes(models.Model): |
|||
"""model for create service wizard""" |
|||
_name = 'fleet.sub.service.type' |
|||
_description = 'Fleet Sub Service Type' |
|||
|
|||
service_type_id = fields.Many2one('fleet.service.type', |
|||
help='Vehicle service type', |
|||
string='Vehicle service type') |
|||
service_category = fields.Char(string='Category', |
|||
help='Vehicle service category',) |
|||
|
|||
@api.onchange('service_type_id') |
|||
def _onchange_service_type_id(self): |
|||
"""select service category """ |
|||
for rec in self: |
|||
rec.service_category = rec.service_type_id.category |
@ -0,0 +1,37 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
"""model to add inspection images""" |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class InspectionImages(models.Model): |
|||
"""Model to add inspection images""" |
|||
_name = 'inspection.images' |
|||
_description = 'Inspection Images' |
|||
|
|||
name = fields.Char(String='Image Name', help='Image name') |
|||
image = fields.Binary(string='Image', help='Inspection Image') |
|||
inspection_id = fields.Many2one('inspection.request', |
|||
help='Vehicle inspection', |
|||
string='Vehicle inspection') |
|||
service_log_id = fields.Many2one('vehicle.service.log', |
|||
help='Service log', |
|||
string='Service log') |
@ -0,0 +1,238 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
"""model for inspection requests """ |
|||
from datetime import timedelta |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class InspectionRequests(models.Model): |
|||
"""create inspection requests""" |
|||
_name = 'inspection.request' |
|||
_description = 'Inspection Request' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
|
|||
name = fields.Char(readonly=True, store=True, |
|||
help='Inspection Request name', |
|||
string='Inspection Request name') |
|||
inspection_id = fields.Many2one('vehicle.inspection', |
|||
required=True, |
|||
help='Select Vehicle Inspection', |
|||
string='Select Vehicle Inspection') |
|||
vehicle_id = fields.Many2one('fleet.vehicle', string='Vehicle', |
|||
help='Select Vehicle for inspection') |
|||
vehicle_model_id = fields.Many2one('fleet.vehicle.model', |
|||
string='Model', |
|||
related="vehicle_id.model_id", |
|||
readonly=False, |
|||
store=True, help='Vehicle model') |
|||
license_plate = fields.Char(string='License Plate', |
|||
related="vehicle_id.license_plate", store=True, |
|||
readonly=False, help='vehicle license plate') |
|||
date_create = fields.Date(string='Inspection Create Date', |
|||
help='Inspection Create Date', |
|||
default=lambda self: fields.Date.today()) |
|||
inspection_date = fields.Date(string='Inspection Date', |
|||
help='Vehicle inspection date', |
|||
default=lambda self: fields.Date.today()) |
|||
user_id = fields.Many2one('res.users', |
|||
string='Inspection Supervisor', |
|||
related='inspection_id.user_id', readonly=False, |
|||
store=True, help='Inspection supervisor') |
|||
company_id = fields.Many2one('res.company', string='Company', |
|||
help='Company', |
|||
default=lambda self: self.env.company) |
|||
image_128 = fields.Image(related='vehicle_model_id.image_128', |
|||
help='Vehicle Image', string='Image') |
|||
inspection_result = fields.Char(string='Inspection Result', |
|||
help='Vehicle inspection result') |
|||
internal_note = fields.Html(string='Internal Note', help='Internal note') |
|||
state = fields.Selection( |
|||
[('draft', 'Draft'), |
|||
('new', 'New'), |
|||
('inspection_started', 'Inspection Started'), |
|||
('inspection_finished', 'Inspection Finished'), ], |
|||
default='draft', copy=False, required=True, tracking=True, |
|||
help='Status of Inspection', string='Status of Inspection') |
|||
inspection_image_ids = fields.One2many('inspection.images', |
|||
'inspection_id', |
|||
help='Add Inspection Images', |
|||
string='Add Inspection Images') |
|||
inspection_line_reference = fields.Integer(string='Inspection Reference', |
|||
help='Inspection Line') |
|||
service_reference = fields.Integer(string='Service Reference', |
|||
help='Service Reference') |
|||
service_active = fields.Boolean('Service active', default=False, |
|||
help='Active Service smart button', |
|||
compute='_compute_service_active') |
|||
fleet_active = fields.Boolean('Service active', default=False, |
|||
help='Active Service smart button', |
|||
compute='_compute_fleet_active') |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""generate vehicle inspection sequence""" |
|||
if vals.get('name', 'New') == 'New': |
|||
vals['name'] = self.env['ir.sequence'].next_by_code( |
|||
'inspection.request') or 'New' |
|||
result = super(InspectionRequests, self, ).create(vals) |
|||
return result |
|||
|
|||
@api.depends('service_active') |
|||
def _compute_service_active(self): |
|||
"""To set service active value """ |
|||
service_count = self.env['fleet.service.inspection'].search_count([ |
|||
('inspection_reference', '=', self.id)]) |
|||
if service_count != 0: |
|||
self.service_active = True |
|||
else: |
|||
self.service_active = False |
|||
|
|||
@api.depends('fleet_active') |
|||
def _compute_fleet_active(self): |
|||
"""To set fleet active value""" |
|||
if self.vehicle_id: |
|||
self.fleet_active = True |
|||
else: |
|||
self.fleet_active = False |
|||
|
|||
def action_confirm_inspection(self): |
|||
"""button to confirm inspection request""" |
|||
self.write({'state': 'new'}) |
|||
inspection_request_line = self.env['inspection.request.line'].search([ |
|||
('inspection_request_reference', '=', self.id) |
|||
]) |
|||
if not inspection_request_line: |
|||
self.env['inspection.request.line'].create({ |
|||
'fleet_vehicle_id': self.vehicle_id.id, |
|||
'description': self.inspection_id.name, |
|||
'inspection_id': self.inspection_id.id, |
|||
'inspection_period': self.inspection_id.inspection_period, |
|||
'reminder_notification': |
|||
self.inspection_id.reminder_notification_days, |
|||
'user_id': self.user_id, |
|||
'next_inspection_date': self.inspection_date, |
|||
}) |
|||
|
|||
def action_print_report(self): |
|||
""" print pdf report""" |
|||
images = [] |
|||
for rec in self.inspection_image_ids: |
|||
images.append(rec.image) |
|||
inspection_request = self.env['inspection.request'].search([ |
|||
('name', '=', self.name) |
|||
]) |
|||
data = { |
|||
'logo': self.vehicle_id.model_id.image_128, |
|||
'vehicle_model_id': self.vehicle_id.model_id.name, |
|||
'records': self.read(), |
|||
'license_plate': self.vehicle_id.license_plate, |
|||
'user_id': inspection_request.user_id.name, |
|||
'images': images, |
|||
} |
|||
return self.env.ref( |
|||
'fleet_vehicle_inspection_management.action_report_vehicle_inspection').report_action( |
|||
self, data=data) |
|||
|
|||
def action_start_inspection(self): |
|||
"""button to start vehicle inspection""" |
|||
self.write({'state': 'inspection_started'}) |
|||
|
|||
def action_finish_inspection(self): |
|||
"""button to make inspection finished""" |
|||
self.write({'state': 'inspection_finished'}) |
|||
|
|||
def action_create_service(self): |
|||
"""opens wizard to create service""" |
|||
if not self.service_reference: |
|||
service_id = self.env['fleet.service.inspection'].create({ |
|||
'inspection_reference': self.id, |
|||
'vehicle_id': self.vehicle_id.id, |
|||
'odometer': self.vehicle_id.odometer |
|||
}) |
|||
self.service_reference = service_id |
|||
return { |
|||
'name': 'Create Service', |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'fleet.service.inspection', |
|||
'view_mode': 'form', |
|||
'target': 'new', |
|||
'res_id': self.service_reference, |
|||
} |
|||
|
|||
def action_create_inspection_request(self): |
|||
"""automatically create inspection request and send reminder email""" |
|||
|
|||
vehicle_inspection_lines = self.env['inspection.request.line'].search( |
|||
[]) |
|||
for lines in vehicle_inspection_lines: |
|||
reminder_day = lines.next_inspection_date - timedelta( |
|||
days=lines.reminder_notification) |
|||
if reminder_day == fields.Date.today(): |
|||
inspection_line_id = self.env['inspection.request'].search([ |
|||
('inspection_line_reference', '=', lines.id)]) |
|||
if not inspection_line_id: |
|||
create_id = self.env['inspection.request'].create({ |
|||
'inspection_id': lines.inspection_id.id, |
|||
'inspection_line_reference': lines.id, |
|||
'vehicle_id': lines.fleet_vehicle_id.id, |
|||
'vehicle_model_id': lines.fleet_vehicle_id.model_id.id, |
|||
'license_plate': lines.fleet_vehicle_id.license_plate, |
|||
'date_create': lines.create_date, |
|||
'inspection_date': lines.next_inspection_date, |
|||
'user_id': lines.user_id.id, |
|||
'company_id': self.env.company.id, |
|||
'image_128': lines.fleet_vehicle_id.model_id.image_128, |
|||
}) |
|||
create_id.write({'state': 'new'}) |
|||
lines.inspection_request_reference = create_id.id |
|||
next_inspection = lines.next_inspection_date + timedelta( |
|||
days=lines.inspection_period) |
|||
lines.last_inspection_date = lines.next_inspection_date |
|||
lines.next_inspection_date = next_inspection |
|||
mail_template_id = self.env.ref( |
|||
'fleet_vehicle_inspection_management.vehicle_inspection_reminder_email_template') |
|||
mail_template_id.send_mail(create_id.id) |
|||
|
|||
def get_vehicle_service(self): |
|||
"""vehicle service smart button""" |
|||
service_id = self.env['fleet.service.inspection'].search([ |
|||
('inspection_reference', '=', self.id)]) |
|||
self.ensure_one() |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'name': 'Vehicle Service log', |
|||
'view_mode': 'tree,form', |
|||
'context': {'create': False}, |
|||
'res_model': 'vehicle.service.log', |
|||
'domain': [('service_reference', '=', service_id.id)], |
|||
} |
|||
|
|||
def get_fleet_vehicle(self): |
|||
"""fleet vehicle smart button""" |
|||
|
|||
self.ensure_one() |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'name': 'Fleet Vehicle', |
|||
'view_mode': 'tree,form', |
|||
'res_model': 'fleet.vehicle', |
|||
'domain': [('id', '=', self.vehicle_id.id)], |
|||
} |
@ -0,0 +1,59 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
""" model for vehicle inspection lines""" |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class InspectionRequestLine(models.Model): |
|||
""" add inspection requests """ |
|||
_name = 'inspection.request.line' |
|||
_description = 'Inspection Request Line' |
|||
|
|||
fleet_vehicle_id = fields.Many2one('fleet.vehicle', |
|||
string='Vehicle', |
|||
help='Select vehicle for the inspection' |
|||
' request.') |
|||
description = fields.Char(string='Description', |
|||
help='Description for inspection request') |
|||
inspection_id = fields.Many2one('vehicle.inspection', |
|||
required=True, |
|||
help='Select vehicle inspection', |
|||
string='Inspection Reference') |
|||
inspection_period = fields.Integer(string='Period(Days)', |
|||
related= |
|||
'inspection_id.inspection_period', |
|||
help='Recurring interval of vehicle' |
|||
' inspection') |
|||
reminder_notification = fields.Integer( |
|||
string='Reminder Notification Date', |
|||
related='inspection_id.reminder_notification_days', |
|||
help='Number of days before need to send Reminder Email') |
|||
user_id = fields.Many2one('res.users', |
|||
string='Inspection Supervisor', |
|||
related='inspection_id.user_id', |
|||
help='Instruction Supervisor') |
|||
last_inspection_date = fields.Date(string='Last Inspection Date', |
|||
help='Date of last inspection ') |
|||
next_inspection_date = fields.Date(string='Next Inspection Date', |
|||
help='Date of next inspection') |
|||
inspection_request_reference = fields.Integer( |
|||
string='Inspection Request Reference', |
|||
help='Inspection Request Reference') |
@ -0,0 +1,40 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
""" model for create vehicle inspections""" |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class VehicleInspection(models.Model): |
|||
""" add vehicle inspections """ |
|||
_name = 'vehicle.inspection' |
|||
_description = 'Vehicle Inspection' |
|||
|
|||
name = fields.Char(string='Name', help='Name of vehicle inspection', |
|||
required=True) |
|||
inspection_period = fields.Integer(string='Period(Days)', |
|||
help='Recurring period of vehicle inspection') |
|||
reminder_notification_days = fields.Integer( |
|||
string='Reminder Notification(Days)', |
|||
help='Number of days before want to send reminder email') |
|||
user_id = fields.Many2one('res.users', string='Inspection Supervisor', |
|||
helps='Inspection supervisor') |
|||
company_id = fields.Many2one('res.company', string='Company', |
|||
help='Company Name') |
@ -0,0 +1,42 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
""" vehicle inspection and service details""" |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class VehicleServiceLog(models.Model): |
|||
""" add vehicle inspection details""" |
|||
_name = 'vehicle.service.log' |
|||
_description = 'Vehicle Service Log' |
|||
_inherit = 'fleet.vehicle.log.services' |
|||
|
|||
service_image_ids = fields.One2many('inspection.images', 'service_log_id', |
|||
help='Inspection Images', |
|||
string='Inspection Images') |
|||
additional_service_ids = fields.One2many('fleet.service.inspection', |
|||
'service_log_id', |
|||
help='Additional Services', |
|||
string='Additional Services') |
|||
inspection_result = fields.Char(string='Inspection Result', |
|||
help='Result of inspection') |
|||
notes = fields.Html(string='Internal Notes', help='Internal notes') |
|||
service_reference = fields.Integer(string='Service Reference', |
|||
help='Service Reference') |
@ -0,0 +1,118 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Template for vehicle inspection report--> |
|||
<template id="report_vehicle_inspection"> |
|||
<t t-call="web.external_layout"> |
|||
<t t-call="web.html_container"> |
|||
<div class="page"> |
|||
<div class="float-left"> |
|||
<t t-if="logo"> |
|||
<img t-attf-src="data:image/png;base64,{{logo}}" |
|||
style="max-height:5cm; max-width:5cm;" |
|||
margin="left"/> |
|||
</t> |
|||
<br/> |
|||
</div> |
|||
<div> |
|||
<table class="table"> |
|||
<thead> |
|||
<tr> |
|||
<td style="text-align: center;" |
|||
colspan="4"> |
|||
<strong> |
|||
<t t-esc="records[0]['name']"/> |
|||
</strong> |
|||
</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td> |
|||
<strong>Vehicle</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="records[0]['vehicle_id'][1]"/> |
|||
</strong> |
|||
</td> |
|||
|
|||
<td> |
|||
<strong>Create Date:</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="records[0]['create_date']"/> |
|||
</strong> |
|||
</td> |
|||
</tr> |
|||
|
|||
<tr> |
|||
<td> |
|||
<strong>Model</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="model_id"/> |
|||
</strong> |
|||
</td> |
|||
|
|||
<td> |
|||
<strong>License Plate:</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="license_plate"/> |
|||
</strong> |
|||
</td> |
|||
</tr> |
|||
|
|||
<tr> |
|||
<td> |
|||
<strong>Inspection Date</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="records[0]['inspection_date']"/> |
|||
</strong> |
|||
</td> |
|||
|
|||
<td> |
|||
<strong>Inspection Supervisor</strong> |
|||
</td> |
|||
<td> |
|||
<strong> |
|||
<t t-esc="user_id"/> |
|||
</strong> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<h3>Images</h3> |
|||
<table> |
|||
<t t-foreach="images" t-as="rec"> |
|||
<t t-if="rec"> |
|||
<img t-attf-src="data:image/png;base64,{{rec}}" |
|||
style="max-height:5cm; max-width:5cm;margin-right:5px;padding-top:10px;" |
|||
margin="left"/> |
|||
</t> |
|||
|
|||
</t> |
|||
|
|||
</table> |
|||
<br/> |
|||
<br/> |
|||
<div class="mt32 mb32"> |
|||
<div class="col-xs-6 text-left"> |
|||
<strong>Supervisor Signature:____________________ |
|||
</strong> |
|||
<br/> |
|||
<br/> |
|||
<strong>Date:____________________</strong> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Vehicle inspection report action--> |
|||
<record id="action_report_vehicle_inspection" model="ir.actions.report"> |
|||
<field name="name">Vehicle Inspection Report</field> |
|||
<field name="model">vehicle.service.log</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">fleet_vehicle_inspection_management.report_vehicle_inspection</field> |
|||
<field name="report_file">fleet_vehicle_inspection_management.report_vehicle_inspection</field> |
|||
</record> |
|||
</odoo> |
|
@ -0,0 +1,22 @@ |
|||
<?xml version='1.0' encoding='utf-8'?> |
|||
<odoo noupdate="1"> |
|||
<!-- Access rights of fleet vehicle inspection--> |
|||
<record id="module_fleet_vehicle_inspection_management" model="ir.module.category" > |
|||
<field name="name">Vehicle Inspection Management</field> |
|||
<field name="description">User access level for Vehicle Inspection module</field> |
|||
<field name="sequence">20</field> |
|||
</record> |
|||
|
|||
<record id="group_vehicle_inspection_supervisor" model="res.groups"> |
|||
<field name="name">Inspection Supervisor</field> |
|||
<field name="category_id" ref="module_fleet_vehicle_inspection_management"/> |
|||
</record> |
|||
|
|||
<record id="group_vehicle_inspection_manager" model="res.groups"> |
|||
<field name="name">Inspection Manager</field> |
|||
<field name="category_id" ref="module_fleet_vehicle_inspection_management"/> |
|||
<field name="implied_ids" |
|||
eval="[(4, ref('fleet_vehicle_inspection_management.group_vehicle_inspection_supervisor'))]"/> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,32 @@ |
|||
<?xml version='1.0' encoding='utf-8'?> |
|||
<odoo noupdate="1"> |
|||
|
|||
<!-- Record rules--> |
|||
<record id="inspection_supervisor_rule" model="ir.rule"> |
|||
<field name="name">Inspection Supervisor Rule</field> |
|||
<field name="model_id" ref="model_inspection_request"/> |
|||
<field name="domain_force">[('user_id', '=', user.id)]</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('fleet_vehicle_inspection_management.group_vehicle_inspection_supervisor'))]"/> |
|||
</record> |
|||
|
|||
<record id="inspection_manager_rule" model="ir.rule"> |
|||
<field name="name">Inspection Manager Rule</field> |
|||
<field ref="model_inspection_request" name="model_id"/> |
|||
<field name="domain_force">[(1,'=',1)]</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('fleet_vehicle_inspection_management.group_vehicle_inspection_manager'))]"/> |
|||
</record> |
|||
|
|||
<!-- multi company rule--> |
|||
<record id="inspection_request_company_rule" model="ir.rule"> |
|||
<field name="name">Inspection Request Company Rule</field> |
|||
<field ref="model_inspection_request" name="model_id"/> |
|||
<field name="domain_force">[('company_id', '=', company_id)]</field> |
|||
</record> |
|||
<record id="vehicle_inspection_company_rule" model="ir.rule"> |
|||
<field name="name">Vehicle Inspection Company Rule</field> |
|||
<field ref="model_vehicle_inspection" name="model_id"/> |
|||
<field name="domain_force">[('company_id', '=', company_id)]</field> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 237 KiB |
After Width: | Height: | Size: 445 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 85 KiB |