diff --git a/fleet_vehicle_inspection_management/README.rst b/fleet_vehicle_inspection_management/README.rst new file mode 100644 index 000000000..c2ea527e5 --- /dev/null +++ b/fleet_vehicle_inspection_management/README.rst @@ -0,0 +1,45 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Vehicle Inspection Management in Fleet +================================================ +* Vehicle Inspection Management in Fleet + +Installation +============ + - www.odoo.com/documentation/16.0/setup/install.html + - Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (AGPL v3) +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: +(V16) Vishnu P + +Contacts +-------- +* Mail Contact : odoo@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 +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ + diff --git a/fleet_vehicle_inspection_management/__init__.py b/fleet_vehicle_inspection_management/__init__.py new file mode 100644 index 000000000..ca9904a15 --- /dev/null +++ b/fleet_vehicle_inspection_management/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +from . import models +from . import wizards diff --git a/fleet_vehicle_inspection_management/__manifest__.py b/fleet_vehicle_inspection_management/__manifest__.py new file mode 100644 index 000000000..c3f3edeb0 --- /dev/null +++ b/fleet_vehicle_inspection_management/__manifest__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +{ + 'name': 'Vehicle Inspection Management in Fleet', + 'version': '16.0.1.0.0', + 'category': 'Industries', + 'summary': 'Vehicle Inspection Management for manage the Vehicle ' + 'Inspection and services', + 'description': 'Vehicle Inspection Management used to manage the Fleet ' + 'Inspection and Services', + 'depends': ['base', 'fleet'], + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.png'], + 'website': 'https://www.cybrosys.com', + 'data': { + 'security/vehicle_inspection_access.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, +} diff --git a/fleet_vehicle_inspection_management/data/ir_cron_data.xml b/fleet_vehicle_inspection_management/data/ir_cron_data.xml new file mode 100644 index 000000000..5ee37245a --- /dev/null +++ b/fleet_vehicle_inspection_management/data/ir_cron_data.xml @@ -0,0 +1,18 @@ + + + + + + Vehicle inspection Request + + code + model.action_create_inspection_request() + + + 1 + days + -1 + 1 + + + \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/data/ir_sequence_data.xml b/fleet_vehicle_inspection_management/data/ir_sequence_data.xml new file mode 100644 index 000000000..25e8fe997 --- /dev/null +++ b/fleet_vehicle_inspection_management/data/ir_sequence_data.xml @@ -0,0 +1,15 @@ + + + + + + Vehicle Inspection Request + inspection.request + INSPECTION/REQUEST + 5 + + + + + + \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/data/mail_template_data.xml b/fleet_vehicle_inspection_management/data/mail_template_data.xml new file mode 100644 index 000000000..7b8b88e26 --- /dev/null +++ b/fleet_vehicle_inspection_management/data/mail_template_data.xml @@ -0,0 +1,56 @@ + + + + + + Vehicle Inspection Notification Email + {{object.user_id.company_id.email}} + + {{object.name}} - + {{object.inspection_id.name}} + + + {{object.user_id.email}} + + +

Dear, +

+
    This Email is about Vehicle Inspection Notification as + below: + +
    + + + + + + + + + + + + + + + +
    VehicleModelLicense Plate
    + + + + + +
    +
    +
    +

    +

+ +

Thank you,

+
+
+
+
+
\ No newline at end of file diff --git a/fleet_vehicle_inspection_management/doc/RELEASE_NOTES.md b/fleet_vehicle_inspection_management/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..761206662 --- /dev/null +++ b/fleet_vehicle_inspection_management/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 16.05.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for Vehicle Inspection Management in Fleet diff --git a/fleet_vehicle_inspection_management/models/__init__.py b/fleet_vehicle_inspection_management/models/__init__.py new file mode 100644 index 000000000..ee11a6092 --- /dev/null +++ b/fleet_vehicle_inspection_management/models/__init__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" import models """ +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 diff --git a/fleet_vehicle_inspection_management/models/fleet_vehicle.py b/fleet_vehicle_inspection_management/models/fleet_vehicle.py new file mode 100644 index 000000000..2a57fa0f9 --- /dev/null +++ b/fleet_vehicle_inspection_management/models/fleet_vehicle.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +from odoo import api, fields, models + +"""model to inherit vehicles in fleet""" + + +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 diff --git a/fleet_vehicle_inspection_management/models/inspection_images.py b/fleet_vehicle_inspection_management/models/inspection_images.py new file mode 100644 index 000000000..8cc3063ff --- /dev/null +++ b/fleet_vehicle_inspection_management/models/inspection_images.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +"""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') diff --git a/fleet_vehicle_inspection_management/models/inspection_request.py b/fleet_vehicle_inspection_management/models/inspection_request.py new file mode 100644 index 000000000..10256c694 --- /dev/null +++ b/fleet_vehicle_inspection_management/models/inspection_request.py @@ -0,0 +1,233 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +"""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): + 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): + 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, + }) + 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)], + } diff --git a/fleet_vehicle_inspection_management/models/inspection_request_line.py b/fleet_vehicle_inspection_management/models/inspection_request_line.py new file mode 100644 index 000000000..34a170528 --- /dev/null +++ b/fleet_vehicle_inspection_management/models/inspection_request_line.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" 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') diff --git a/fleet_vehicle_inspection_management/models/vehicle_inspection.py b/fleet_vehicle_inspection_management/models/vehicle_inspection.py new file mode 100644 index 000000000..94a418fc8 --- /dev/null +++ b/fleet_vehicle_inspection_management/models/vehicle_inspection.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" 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') diff --git a/fleet_vehicle_inspection_management/models/vehicle_service_log.py b/fleet_vehicle_inspection_management/models/vehicle_service_log.py new file mode 100644 index 000000000..bd05730ed --- /dev/null +++ b/fleet_vehicle_inspection_management/models/vehicle_service_log.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" 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') diff --git a/fleet_vehicle_inspection_management/reports/vehicle_inspection_report_templates.xml b/fleet_vehicle_inspection_management/reports/vehicle_inspection_report_templates.xml new file mode 100644 index 000000000..f80c74189 --- /dev/null +++ b/fleet_vehicle_inspection_management/reports/vehicle_inspection_report_templates.xml @@ -0,0 +1,119 @@ + + + + + + diff --git a/fleet_vehicle_inspection_management/reports/vehicle_inspection_reports.xml b/fleet_vehicle_inspection_management/reports/vehicle_inspection_reports.xml new file mode 100644 index 000000000..5aa98a884 --- /dev/null +++ b/fleet_vehicle_inspection_management/reports/vehicle_inspection_reports.xml @@ -0,0 +1,11 @@ + + + + + Vehicle Inspection Report + vehicle.service.log + qweb-pdf + fleet_vehicle_inspection_management.report_vehicle_inspection + fleet_vehicle_inspection_management.report_vehicle_inspection + + diff --git a/fleet_vehicle_inspection_management/security/ir.model.access.csv b/fleet_vehicle_inspection_management/security/ir.model.access.csv new file mode 100644 index 000000000..0aad4e7bb --- /dev/null +++ b/fleet_vehicle_inspection_management/security/ir.model.access.csv @@ -0,0 +1,8 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_vehicle_inspection,vehicle_inspection,model_vehicle_inspection,base.group_user,1,1,1,1 +access_inspection_request,inspection_request,model_inspection_request,base.group_user,1,1,1,1 +access_inspection_images,inspection_images,model_inspection_images,base.group_user,1,1,1,1 +access_inspection_request_line,inspection_request_line,model_inspection_request_line,base.group_user,1,1,1,1 +access_fleet_service_inspection,fleet_service_inspection,model_fleet_service_inspection,base.group_user,1,1,1,1 +access_fleet_sub_service_type,fleet_sub_service_type,model_fleet_sub_service_type,base.group_user,1,1,1,1 +access_vehicle_service_log,vehicle_service_log,model_vehicle_service_log,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/security/vehicle_inspection_access.xml b/fleet_vehicle_inspection_management/security/vehicle_inspection_access.xml new file mode 100644 index 000000000..e0dfcde88 --- /dev/null +++ b/fleet_vehicle_inspection_management/security/vehicle_inspection_access.xml @@ -0,0 +1,51 @@ + + + + + Vehicle Inspection Management + User access level for Vehicle Inspection + module + + 20 + + + + Inspection Supervisor + + + + + Inspection Manager + + + + + + Inspection Supervisor Rule + + [('user_id', '=', user.id)] + + + + + Inspection Manager Rule + + [(1,'=',1)] + + + + + Inspection Request Company Rule + + [('company_id', '=', company_id)] + + + + Vehicle Inspection Company Rule + + [('company_id', '=', company_id)] + + \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/check.png b/fleet_vehicle_inspection_management/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/check.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/chevron.png b/fleet_vehicle_inspection_management/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/chevron.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/cogs.png b/fleet_vehicle_inspection_management/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/cogs.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/consultation.png b/fleet_vehicle_inspection_management/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/consultation.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/ecom-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/ecom-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/education-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/education-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/hotel-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/hotel-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/license.png b/fleet_vehicle_inspection_management/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/license.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/lifebuoy.png b/fleet_vehicle_inspection_management/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/lifebuoy.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/manufacturing-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/manufacturing-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/pos-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/pos-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/puzzle.png b/fleet_vehicle_inspection_management/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/puzzle.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/restaurant-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/restaurant-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/service-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/service-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/trading-black.png b/fleet_vehicle_inspection_management/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/trading-black.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/training.png b/fleet_vehicle_inspection_management/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/training.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/update.png b/fleet_vehicle_inspection_management/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/update.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/user.png b/fleet_vehicle_inspection_management/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/user.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/icons/wrench.png b/fleet_vehicle_inspection_management/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/icons/wrench.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/categories.png b/fleet_vehicle_inspection_management/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/categories.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/check-box.png b/fleet_vehicle_inspection_management/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/check-box.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/compass.png b/fleet_vehicle_inspection_management/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/compass.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/corporate.png b/fleet_vehicle_inspection_management/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/corporate.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/customer-support.png b/fleet_vehicle_inspection_management/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/customer-support.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/cybrosys-logo.png b/fleet_vehicle_inspection_management/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/cybrosys-logo.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/features.png b/fleet_vehicle_inspection_management/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/features.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/logo.png b/fleet_vehicle_inspection_management/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/logo.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/pictures.png b/fleet_vehicle_inspection_management/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/pictures.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/pie-chart.png b/fleet_vehicle_inspection_management/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/pie-chart.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/right-arrow.png b/fleet_vehicle_inspection_management/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/right-arrow.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/star.png b/fleet_vehicle_inspection_management/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/star.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/support.png b/fleet_vehicle_inspection_management/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/support.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/misc/whatsapp.png b/fleet_vehicle_inspection_management/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/misc/whatsapp.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/1.png b/fleet_vehicle_inspection_management/static/description/assets/modules/1.png new file mode 100644 index 000000000..be454ea44 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/1.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/2.png b/fleet_vehicle_inspection_management/static/description/assets/modules/2.png new file mode 100644 index 000000000..f9706edbe Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/2.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/3.png b/fleet_vehicle_inspection_management/static/description/assets/modules/3.png new file mode 100644 index 000000000..1b74092f0 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/3.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/4.png b/fleet_vehicle_inspection_management/static/description/assets/modules/4.png new file mode 100644 index 000000000..65fda8b6b Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/4.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/5.png b/fleet_vehicle_inspection_management/static/description/assets/modules/5.png new file mode 100644 index 000000000..16ad8ca2d Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/5.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/modules/6.png b/fleet_vehicle_inspection_management/static/description/assets/modules/6.png new file mode 100644 index 000000000..e894393ef Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/modules/6.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/0-1.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/0-1.png new file mode 100644 index 000000000..2550bfe09 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/0-1.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/0.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/0.png new file mode 100644 index 000000000..492ecafa1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/0.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/1.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..72e33605d Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/1.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/10.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..09cd7bc34 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/10.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/11.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..403410f44 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/11.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/12.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..0384e7e97 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/12.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/13.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..8bc4983e4 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/13.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/14.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..ecd1734a1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/14.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/15.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/15.png new file mode 100644 index 000000000..d454957f1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/15.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/16.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..305ed2c30 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/16.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/17.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/17.png new file mode 100644 index 000000000..d94254683 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/17.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/18.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/18.png new file mode 100644 index 000000000..9ed42d0fb Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/18.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/19.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/19.png new file mode 100644 index 000000000..406a432e9 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/19.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/2.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..44e081296 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/2.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/20.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/20.png new file mode 100644 index 000000000..256e1d62f Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/20.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/21.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/21.png new file mode 100644 index 000000000..ea3e83dab Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/21.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/22.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/22.png new file mode 100644 index 000000000..1fe8f7a8a Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/22.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/23.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/23.png new file mode 100644 index 000000000..3c7469acd Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/23.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/24.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/24.png new file mode 100644 index 000000000..3fb63a8fa Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/24.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/25.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/25.png new file mode 100644 index 000000000..0c3d8c701 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/25.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/26.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/26.png new file mode 100644 index 000000000..20abfa632 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/26.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/27.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/27.png new file mode 100644 index 000000000..4de685b86 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/27.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/28.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/28.png new file mode 100644 index 000000000..f0e340b77 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/28.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/29.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/29.png new file mode 100644 index 000000000..1a06e289c Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/29.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/3.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..ef4f3e839 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/3.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/30.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/30.png new file mode 100644 index 000000000..5747cbe9b Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/30.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/31.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/31.png new file mode 100644 index 000000000..012038bb1 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/31.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/4.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..5b09734b9 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/4.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/5.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..9c6210faa Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/5.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/6.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..d29b1b0db Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/6.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/7.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..fae19f976 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/7.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/8.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..ccbad5df0 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/8.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/9.png b/fleet_vehicle_inspection_management/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..5a9892454 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/9.png differ diff --git a/fleet_vehicle_inspection_management/static/description/assets/screenshots/hero.gif b/fleet_vehicle_inspection_management/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..d090356a6 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/assets/screenshots/hero.gif differ diff --git a/fleet_vehicle_inspection_management/static/description/banner.png b/fleet_vehicle_inspection_management/static/description/banner.png new file mode 100644 index 000000000..bf3975a92 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/banner.png differ diff --git a/fleet_vehicle_inspection_management/static/description/icon.png b/fleet_vehicle_inspection_management/static/description/icon.png new file mode 100644 index 000000000..393d84d14 Binary files /dev/null and b/fleet_vehicle_inspection_management/static/description/icon.png differ diff --git a/fleet_vehicle_inspection_management/static/description/index.html b/fleet_vehicle_inspection_management/static/description/index.html new file mode 100644 index 000000000..c16decc48 --- /dev/null +++ b/fleet_vehicle_inspection_management/static/description/index.html @@ -0,0 +1,880 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Vehicle Inspection Management in Fleet.

+

+ Manage Recurring Inspection of vehicles or fleets.

+ + +
+
+
+ + +
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module helps to manage Vehicle Inspection for all vehicles or + fleets. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Option to create and manage vehicle inspection on vehicle form view. +
+
+ + Option to set up and manage different inspections. +
+
+ + Recurring Vehicle Inspections. +
+ +
+ + Option to send Automatic Vehicle Inspection Reminder Email. + +
+
+ + Option to create vehicle service from Inspection Request. + +
+
+ + Option to Print Vehicle Inspection PDF Report. +
+
+ +
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Vehicle Inspection Management User Access +

+

+ Go to Settings -> User & Companies + -> + Users. There has two user access 'Inspection Manager' and + 'Inspection Supervisor'.

+ + + +
+ +
+

+ Vehicle Inspection +

+

+ In Fleet -> Configuration -> Vehicle Inspection, + Can see all Vehicle Inspections

+ +

+ There has option to create Vehicle Inspection.

+ + +
+
+

+ Create Inspection Requests +

+

+ In Fleet -> Vehicles ->have 'Inspection Lines' Tab,here we can + add inspections for that vehicle.

+ + + + +

+ When we reach the Inspection Reminder day it automatically + creates a Inspection Request and it sends a Vehicle Inspection + Reminder Email to the Inspection Supervisor. +

+ + + In Fleet -> Inspection Request -> has different menus.Inspection + Request,Inspection to Start and Inspection to Finish. +

+ +

+ 'Inspection Request' Menu shows all existing Inspection + Requests. +

+ +

+ 'Inspection to Start' Menu shows all existing Inspection + Requests in 'Inspection Started' State. +

+ +

+ 'Inspection to Finish' Menu shows all existing Inspection + Requests in 'Inspection Finished' State. + +

+ +

+ Inspection Request in Kanban View +

+ + +

+ Inspection Request in Calendar View +

+

+

+ + + +
+
+

+ Inspection Request in Form View +

+

+ + +

+
+ +

+ We can create Inspection Request directly by clicking CREATE + button,but the created Inspection Request is in draft + state.

+ + +
+
+ +

+ We can change the state of Inspection Request into 'New' by + clicking the 'Confirm' button and it will be added into the + Inspection Lines.

+ + +
+
+ +

+

+ + +
+ + +
+ +

+ There has 'START INSPECTION' button to start the vehicle + inspection. +

+ + +
+ +
+ +

+ The state will be changed into 'Inspection Started' state.There + has option to give Inspection Result and Internal Note under + Inspection Information tab. +

+ + +
+ +
+ +

We can add Inspection Images under Inspection Images +

+ + +
+ +
+ +

We can create service by clicking 'CREATE SERVICE' button. +

+ + +
+ +
+ +

If you click 'CREATE SERVICE' button,a wizard will be open and we need to provide the necessory details. +

+ + +
+ +
+ +

There has an option add Service types and sub service types.The Service will be created by clicking 'CREATE SERVICE' button. +

+ + +
+ +
+ +

In Fleet -> Services, we can see all created services. +

+ + +
+
+ +

We can see the last created service in 'New' State. +

+ + +
+ +
+ +

in the Inspection Request form view has 'Service' smart tab. +

+ + +
+ +
+ +

here can see the all services of that Inspection Request by clicking the 'Service' smart tab. +

+ + +
+
+ +

by clicking the service we can see the all the details of inspection Request and Service. +

+ + + +
+ +
+ +

There has 'PDF Report' button to print the PDF Report. +

+ + + +
+ +
+
+ + + +
+
+ +
+

+ Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + + +
+
+ +
+

+ Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/views/fleet_vehicle_log_services_views.xml b/fleet_vehicle_inspection_management/views/fleet_vehicle_log_services_views.xml new file mode 100644 index 000000000..aad0c343f --- /dev/null +++ b/fleet_vehicle_inspection_management/views/fleet_vehicle_log_services_views.xml @@ -0,0 +1,23 @@ + + + + + + fleet.service.log.view.form.inherit.fleet.vehicle.inspection.management + + fleet.vehicle.log.services + + + + + + + + + + + + + \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/views/fleet_vehicle_views.xml b/fleet_vehicle_inspection_management/views/fleet_vehicle_views.xml new file mode 100644 index 000000000..6200bd89c --- /dev/null +++ b/fleet_vehicle_inspection_management/views/fleet_vehicle_views.xml @@ -0,0 +1,43 @@ + + + + + + fleet.vehicle.view.form.inherit.fleet.vehicle.inspection.management + + fleet.vehicle + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fleet_vehicle_inspection_management/views/inspection_request_views.xml b/fleet_vehicle_inspection_management/views/inspection_request_views.xml new file mode 100644 index 000000000..ecc356543 --- /dev/null +++ b/fleet_vehicle_inspection_management/views/inspection_request_views.xml @@ -0,0 +1,309 @@ + + + + + Inspection Requests + ir.actions.act_window + inspection.request + tree,form,kanban,calendar + +

+ Create a new record! +

+
+
+ + Started Inspections + ir.actions.act_window + inspection.request + tree,form,kanban,calendar + [('state','=','inspection_started')] + {'create': False} + +

+ Create a new record! +

+
+
+ + + Finished Inspections + ir.actions.act_window + inspection.request + tree,form,kanban,calendar + [('state','=','inspection_finished')] + {'create': False} + +

+ Create a new record! +

+
+
+ + + + + + + + + inspection.request.view.form + inspection.request + +
+
+ +
+ +
+ + +
+ +
+

+ + +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + +
+ +
+
+
+
+
+
+ + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+ + + inspection.request.view.tree + inspection.request + + + + + + + + + + + + + + + + + inspection.request.view.kanban + inspection.request + + + + +
+
+
+
+ + + +
+
+ + Vehicle: + + +
+
+ + Model: + + +
+
+ + Inspection Supervisor: + + +
+
+ + Inspection Date: + + +
+
+
+
+
+
+
+
+
+ + inspection.request.view.calendar + inspection.request + + + + + + + + + + + + + + inspection.request.view.search + inspection.request + + + + + + + + + + + +
\ No newline at end of file diff --git a/fleet_vehicle_inspection_management/views/vehicle_inspection_views.xml b/fleet_vehicle_inspection_management/views/vehicle_inspection_views.xml new file mode 100644 index 000000000..074581593 --- /dev/null +++ b/fleet_vehicle_inspection_management/views/vehicle_inspection_views.xml @@ -0,0 +1,36 @@ + + + + + Vehicle Inspection + ir.actions.act_window + vehicle.inspection + tree,kanban + +

+ Create a new record! +

+
+
+ + + + + + vehicle.inspection.view.tree + vehicle.inspection + + + + + + + + + + +
\ No newline at end of file diff --git a/fleet_vehicle_inspection_management/views/vehicle_service_log_views.xml b/fleet_vehicle_inspection_management/views/vehicle_service_log_views.xml new file mode 100644 index 000000000..a3b955013 --- /dev/null +++ b/fleet_vehicle_inspection_management/views/vehicle_service_log_views.xml @@ -0,0 +1,119 @@ + + + + + Vehicle Service Logs + ir.actions.act_window + vehicle.service.log + tree,form,kanban + +

+ Create a new record! +

+
+
+ + + + vehicle.service.log.view.form + vehicle.service.log + +
+ + + + + + + + + + + + + + + +

Additional Services

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + +
+ +
+
+
+
+
+
+ + + + + + + + + +
+
+
+
+ +
+
+ + + vehicle.service.log.view.tree + vehicle.service.log + + + + + + + + + + +
\ No newline at end of file diff --git a/fleet_vehicle_inspection_management/wizards/__init__.py b/fleet_vehicle_inspection_management/wizards/__init__.py new file mode 100644 index 000000000..24850605b --- /dev/null +++ b/fleet_vehicle_inspection_management/wizards/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" import wizard """ +from . import fleet_service_inspection diff --git a/fleet_vehicle_inspection_management/wizards/fleet_service_inspection.py b/fleet_vehicle_inspection_management/wizards/fleet_service_inspection.py new file mode 100644 index 000000000..4c1372192 --- /dev/null +++ b/fleet_vehicle_inspection_management/wizards/fleet_service_inspection.py @@ -0,0 +1,154 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +# Version 3 (AGPL v3) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +################################################################################ +""" create service from inspection requests""" +from odoo import api, fields, models + + +class FleetServiceInspection(models.TransientModel): + """ create vehicle service""" + _name = 'fleet.service.inspection' + + service_subtype_ids = fields.Many2many('fleet.service.type', + string='Sub service Type', + help='Related filed for the ' + 'sub service type') + inspection_reference = fields.Integer(string='Inspection_id', + help='Inspection Id') + service_type_id = fields.Many2one('fleet.service.type', string='Services', + help='Services') + service_id = fields.Many2one('fleet.vehicle.log.services', + help='Service Reference', + string='Service Reference') + service_log_id = fields.Many2one('vehicle.service.log', + help='Service log Reference', + string='Service log Reference') + service_category = fields.Selection([('service', 'Service'), + ('contract', 'Contract'), ], + help='Service Category type.', + string='Service Category') + vehicle_id = fields.Many2one('fleet.vehicle', help='Vehicle', + string='Vehicle') + odometer = fields.Float(string='Last Odometer', + help='Odometer measure of the vehicle at the moment of this log') + odometer_unit = fields.Selection([('kilometers', 'km'), + ('miles', 'mi') + ], 'Odometer Unit', + default='kilometers', required=True) + sub_service_reference = fields.Integer(string='Sub Services', + help='Vehicle sub service ') + log_sub_service = fields.Integer(string='Sub Services', + help='Vehicle sub service ') + amount = fields.Monetary(string='Cost', help='Amount',) + date = fields.Date(string='Vehicle Service Date', + help='Vehicle Service Date', + String='Vehicle Service Date') + company_id = fields.Many2one('res.company', string='Company', + help='Company', + default=lambda self: self.env.company) + currency_id = fields.Many2one('res.currency', + related='company_id.currency_id', + string='Currency', help='Currency') + vendor_id = fields.Many2one('res.partner', string='Vendor', help='Vendor') + + @api.onchange('service_type_id') + def _onchange_service_category(self): + """ function to service category """ + self.vehicle_id = self.service_log_id.vehicle_id.id + for rec in self: + rec.service_category = rec.service_type_id.category + + def action_create_service(self): + """ create vehicle service""" + service_id = self.env['fleet.vehicle.log.services'].search([ + ('inspection_reference', '=', self.id)]) + if not service_id: + inspection_id = self.env['inspection.request'].browse( + self.inspection_reference) + self.env['fleet.vehicle.log.services'].create({ + 'inspection_reference': self.id, + 'description': inspection_id.inspection_id.name, + 'service_type_id': self.service_type_id.id, + 'date': fields.Date.today(), + 'vehicle_id': self.vehicle_id.id, + 'odometer': self.odometer, + 'sub_service_ids': [(0, 0, { + 'service_type_id': rec.id, + 'vehicle_id': self.vehicle_id.id, + 'sub_service_reference': rec.id, + 'service_category': rec.category, + }) for rec in self.service_subtype_ids] + })[0] + else: + for rec in self.service_subtype_ids: + sub_service_id = self.env['fleet.service.inspection'].search([ + ('sub_service_reference', '=', rec.id)]) + if not sub_service_id: + service_id.write({ + 'sub_service_ids': [(0, 0, { + 'service_type_id': rec.id, + 'vehicle_id': self.vehicle_id.id, + 'sub_service_reference': rec.id, + 'service_category': rec.category, + })], + }) + service_log_id = self.env['vehicle.service.log'].search([ + ('service_reference', '=', self.id)]) + if not service_log_id: + inspection_id = self.env['inspection.request'].browse( + self.inspection_reference) + self.env['vehicle.service.log'].create({ + 'service_reference': self.id, + 'vehicle_id': self.vehicle_id.id, + 'service_type_id': self.service_type_id.id, + 'amount': self.amount, + 'odometer': self.odometer, + 'odometer_unit': self.odometer_unit, + 'date': self.date, + 'vendor_id': self.vendor_id, + 'inspection_name': inspection_id.name, + 'inspection_result': inspection_id.inspection_result, + 'notes': inspection_id.internal_note, + 'additional_service_ids': [(0, 0, { + 'service_type_id': rec.id, + 'vehicle_id': self.vehicle_id.id, + 'log_sub_service': rec.id, + 'service_category': rec.category, + }) for rec in self.service_subtype_ids], + 'service_image_ids': [(0, 0, { + 'name': rec.name, + 'image': rec.image, + }) for rec in inspection_id.inspection_image_ids] + }) + else: + for rec in self.service_subtype_ids: + sub_service_id = self.env['fleet.service.inspection'].search([ + ('log_sub_service', '=', rec.id)]) + if not sub_service_id: + service_log_id.write({ + 'additional_service_ids': [(0, 0, { + 'service_type_id': rec.id, + 'vehicle_id': self.vehicle_id.id, + 'service_log_id': rec.id, + 'service_category': rec.category, + })], + }) diff --git a/fleet_vehicle_inspection_management/wizards/fleet_service_inspection_views.xml b/fleet_vehicle_inspection_management/wizards/fleet_service_inspection_views.xml new file mode 100644 index 000000000..3f42dccca --- /dev/null +++ b/fleet_vehicle_inspection_management/wizards/fleet_service_inspection_views.xml @@ -0,0 +1,45 @@ + + + + + fleet.service.inspection.view.form + fleet.service.inspection + +
+ + + + + + + + + +
+
+ +
+
+ + + + fleet.service.inspection + ir.actions.act_window + fleet.service.inspection + form + + new + +
+