@ -0,0 +1,48 @@ |
|||
.. 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 |
|||
|
|||
Fleet Complete Report |
|||
===================== |
|||
This module allows the users to print complete fleet report. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, v3.0 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers : (V17) Bhagyadev KP, |
|||
(V18) Aysha Shalin, |
|||
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 `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import report |
|||
from . import wizard |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': 'Fleet Complete Report', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Human Resources', |
|||
'summary': 'This module allow to print complete fleet report.', |
|||
'description': """This module allows to print complete fleet report, Which |
|||
includes vehicle and contract details, services and driver history.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['fleet'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'report/vehicle_detail_report_templates.xml', |
|||
'report/vehicle_detail_reports.xml', |
|||
'wizard/vehicle_detail_views.xml' |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <fleet_complete_report> |
|||
|
|||
#### 07.09.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Fleet Complete Report |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import report_vehicle_detail |
@ -0,0 +1,85 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ReportVehicleDetail(models.TransientModel): |
|||
_name = 'report.fleet_complete_report.report_vehicle_detail' |
|||
_description = 'Vehicle Details Report' |
|||
|
|||
@api.model |
|||
def _get_report_values(self, docids, data=None): |
|||
""" |
|||
Overrides the method to create custom report with custom values |
|||
:param docids: the recordset/ record from which the report action is |
|||
invoked |
|||
:param data: report data |
|||
:return: data and recodsets to be used in the report template |
|||
""" |
|||
docs = self.env['vehicle.detail'].browse( |
|||
self.env.context.get('active_id')) |
|||
lang = self.env['res.lang'].search( |
|||
[('code', '=', self.env.context.get('lang'))]) |
|||
vehicle_ids = data.get('vehicle_ids') |
|||
vehicles = docs.vehicle_ids.browse(vehicle_ids) |
|||
vehicles = vehicles.sorted(key=lambda rec: rec.state_id.sequence) |
|||
states = docs.state_ids.sorted(key=lambda rec: rec.sequence) |
|||
period = None |
|||
end_date = docs.end_date |
|||
if not end_date: |
|||
end_date = fields.Date.context_today(self) |
|||
if docs.start_date: |
|||
period = "From " + docs.start_date.strftime( |
|||
lang.date_format) + " To " + end_date.strftime(lang.date_format) |
|||
contracts = self.env['fleet.vehicle.log.contract'].sudo().search( |
|||
[('vehicle_id', 'in', vehicles.ids), |
|||
('start_date', '<=', end_date), |
|||
'|', ('expiration_date', '>=', docs.start_date), |
|||
('expiration_date', '=', False) |
|||
], |
|||
order='vehicle_id ASC, state ASC, start_date DESC') |
|||
services = self.env['fleet.vehicle.log.services'].sudo().search( |
|||
[('vehicle_id', 'in', vehicles.ids), |
|||
('date', '>=', docs.start_date), ('date', '<=', end_date)], |
|||
order='vehicle_id ASC, date DESC') |
|||
odometers = self.env['fleet.vehicle.odometer'].sudo().search( |
|||
[('vehicle_id', 'in', vehicles.ids), |
|||
('date', '>=', docs.start_date), ('date', '<=', end_date)], |
|||
order='vehicle_id ASC, date DESC') |
|||
drivers_history = self.env[ |
|||
'fleet.vehicle.assignation.log'].sudo().search( |
|||
[('vehicle_id', 'in', vehicles.ids), ('date_start', '<=', end_date), |
|||
'|', ('date_end', '>=', docs.start_date), |
|||
('date_end', '=', False)], order='vehicle_id ASC, date_start ASC') |
|||
return { |
|||
'doc_ids': self.ids, |
|||
'docs': docs, |
|||
'states': states, |
|||
'state_names': ", ".join(states.mapped('name')), |
|||
'vehicles': vehicles, |
|||
'vehicle_names': ", ".join(vehicles.mapped('name')), |
|||
'period': period, |
|||
'contracts': contracts, |
|||
'services': services, |
|||
'odometers': odometers, |
|||
'drivers_history': drivers_history |
|||
} |
@ -0,0 +1,313 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Report template --> |
|||
<template id="report_vehicle_detail"> |
|||
<t t-call="web.html_container"> |
|||
<t t-call="web.basic_layout"> |
|||
<t t-foreach="docs" t-as="o"> |
|||
<div class="page"> |
|||
<div style="padding-bottom:20px !important;" class="oe_structure" /> |
|||
<h1 align="center">Fleet - Complete Report</h1><br /> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr t-if="period"> |
|||
<th>Period</th> |
|||
<td colspan="2"><span t-esc="period" /></td> |
|||
</tr> |
|||
<tr t-if="state_names"> |
|||
<th>Vehicle states</th> |
|||
<td colspan="2"><span t-esc="state_names" /></td> |
|||
</tr> |
|||
<tr t-if="vehicle_names"> |
|||
<th>Vehicles</th> |
|||
<td colspan="2"><span t-esc="vehicle_names" /></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<t t-if="not o.exclude_vehicle_data and vehicles"> |
|||
<h2>Vehicles</h2> |
|||
<t t-foreach="vehicles" t-as="vehicle"> |
|||
<h5 t-esc="vehicle.name" /> |
|||
<table name="vehicle" class="table table-condensed"> |
|||
<tbody> |
|||
<thead> |
|||
<th><b>Model</b></th> |
|||
<th><b>License Plate</b></th> |
|||
<th><b>Immatriculation Date</b></th> |
|||
<th><b>Chassis Number</b></th> |
|||
<th><b>Last Odometer</b></th> |
|||
</thead> |
|||
<tr> |
|||
<td><span t-esc="vehicle.model_id.name" /></td> |
|||
<td><span t-esc="vehicle.license_plate" /></td> |
|||
<td><span t-esc="vehicle.acquisition_date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="vehicle.vin_sn" /></td> |
|||
<td><span t-esc="vehicle.odometer" /> <span t-if="vehicle.odometer_unit"> |
|||
<t t-esc="dict(vehicle.fields_get(allfields=['odometer_unit'])['odometer_unit']['selection'])[vehicle.odometer_unit]" /> |
|||
</span> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th><b>Fleet Manager</b></th> |
|||
<th><b>Location</b></th> |
|||
<th><b>Driver</b></th> |
|||
<th><b>Future Driver</b></th> |
|||
<th><b>Assignment Date</b></th> |
|||
</tr> |
|||
<tr> |
|||
<td><span t-esc="vehicle.manager_id.name" /></td> |
|||
<td><span t-esc="vehicle.location" /></td> |
|||
<td><span t-esc="vehicle.driver_id.name" /></td> |
|||
<td><span t-esc="vehicle.future_driver_id.name" /></td> |
|||
<td><span t-esc="vehicle.next_assignation_date" t-options="{'widget': 'date'}" /></td> |
|||
</tr> |
|||
<tr> |
|||
<th><b>Horsepower Taxation</b></th> |
|||
<th><b>First Contract Date</b></th> |
|||
<th><b>Catalog Value (VAT Incl.)</b></th> |
|||
<th><b>Purchase Value</b></th> |
|||
<th><b>Residual Value</b></th> |
|||
</tr> |
|||
<tr> |
|||
<td><span t-esc="vehicle.horsepower_tax" t-options="{'widget': 'monetary', 'display_currency': vehicle.currency_id}" /></td> |
|||
<td><span t-esc="vehicle.first_contract_date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="vehicle.car_value" t-options="{'widget': 'monetary', 'display_currency': vehicle.currency_id}" /></td> |
|||
<td><span t-esc="vehicle.net_car_value" t-options="{'widget': 'monetary', 'display_currency': vehicle.currency_id}" /></td> |
|||
<td><span t-esc="vehicle.residual_value" t-options="{'widget': 'monetary', 'display_currency': vehicle.currency_id}" /></td> |
|||
</tr> |
|||
<tr> |
|||
<th><b>Model Year</b></th> |
|||
<th><b>Transmission</b></th> |
|||
<th><b>Color</b></th> |
|||
<th><b>Seats Number</b></th> |
|||
<th><b>Doors Number</b></th> |
|||
</tr> |
|||
<tr> |
|||
<td><span t-esc="vehicle.model_year" /></td> |
|||
<td><span t-if="vehicle.transmission"> |
|||
<t t-esc="dict(vehicle.fields_get(allfields=['transmission'])['transmission']['selection'])[vehicle.transmission]" /> |
|||
</span> |
|||
</td> |
|||
<td><span t-esc="vehicle.color" /></td> |
|||
<td><span t-esc="vehicle.seats" /></td> |
|||
<td><span t-esc="vehicle.doors" /></td> |
|||
</tr> |
|||
<tr> |
|||
<th><b>Horsepower</b></th> |
|||
<th><b>Power</b></th> |
|||
<th><b>Fuel Type</b></th> |
|||
<th><b>CO2 Emissions</b></th> |
|||
<th><b>CO2 Standard</b></th> |
|||
</tr> |
|||
<tr> |
|||
<td><span t-esc="vehicle.horsepower" /></td> |
|||
<td><span t-esc="vehicle.power" /> kW</td> |
|||
<td><span t-if="vehicle.fuel_type"> |
|||
<t t-esc="dict(vehicle.fields_get(allfields=['fuel_type'])['fuel_type']['selection'])[vehicle.fuel_type]" /> |
|||
</span> |
|||
</td> |
|||
<td><span t-esc="vehicle.co2" /> g/km</td> |
|||
<td><span t-esc="vehicle.co2_standard" /></td> |
|||
</tr> |
|||
<tr> |
|||
<th><b>Plan To Change Car</b></th> |
|||
<th><b>Trailer Hitch</b></th> |
|||
</tr> |
|||
<tr> |
|||
<td><span><input type="checkbox" t-att-checked="vehicle.plan_to_change_car" /></span></td> |
|||
<td><span><input type="checkbox" t-att-checked="vehicle.trailer_hook" /></span></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
<p style="page-break-after:always;" /> |
|||
</t> |
|||
|
|||
<t t-if="contracts"> |
|||
<h2>Contracts</h2> |
|||
<table name="contracts" class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Vehicle</th> |
|||
<th>Contract Name</th> |
|||
<th>Contract Type</th> |
|||
<th>Responsible</th> |
|||
<th>Vendor</th> |
|||
<th>Driver</th> |
|||
<th>Activation Cost</th> |
|||
<th>Recurring Cost</th> |
|||
<th>Invoice Date</th> |
|||
<th>Contract Start Date</th> |
|||
<th>Contract Expiration Date</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-set="report_vehicle" t-value="false" /> |
|||
<t t-foreach="contracts" t-as="contract"> |
|||
<tr> |
|||
<t t-if="not report_vehicle or report_vehicle != contract.vehicle_id"> |
|||
<t t-set="report_vehicle" t-value="contract.vehicle_id"/> |
|||
<td><span t-esc="contract.vehicle_id.name"/></td> |
|||
</t> |
|||
<t t-else=""> |
|||
<td/> |
|||
</t> |
|||
<td><span t-esc="contract.name" /></td> |
|||
<td><span t-esc="contract.cost_subtype_id.name" /></td> |
|||
<td><span t-esc="contract.user_id.name" /></td> |
|||
<td><span t-esc="contract.insurer_id.name" /></td> |
|||
<td><span t-esc="contract.purchaser_id.name" /></td> |
|||
<td><span t-esc="contract.amount" t-options="{'widget': 'monetary', 'display_currency': contract.currency_id}" /></td> |
|||
<td><span t-esc="contract.cost_generated" t-options="{'widget': 'monetary', 'display_currency': contract.currency_id}" /></td> |
|||
<td><span t-esc="contract.date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="contract.start_date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="contract.expiration_date" t-options="{'widget': 'date'}"/></td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
|
|||
<t t-if="services"> |
|||
<p style="page-break-after:always;" /> |
|||
<h2>Services</h2> |
|||
<table name="services" class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Vehicle</th> |
|||
<th>Service Type</th> |
|||
<th>Driver</th> |
|||
<th>Date</th> |
|||
<th>Cost</th> |
|||
<th>Odometer Value</th> |
|||
<th>Vendor</th> |
|||
<th>Notes</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-set="report_vehicle" t-value="false" /> |
|||
<t t-set="total_cost" t-value="0" /> |
|||
<t t-set="service_cost" t-value="0" /> |
|||
<t t-foreach="services" t-as="service"> |
|||
<t t-if="not report_vehicle or report_vehicle != service.vehicle_id"> |
|||
<tr t-if="report_vehicle"> |
|||
<td colspan="1" /> |
|||
<th align="right">Service Cost</th> |
|||
<th><span t-esc="service_cost" t-options="{'widget': 'monetary', 'display_currency': service.currency_id}" /></th> |
|||
<td colspan="5" /> |
|||
</tr> |
|||
<t t-set="service_cost" t-value="0" /> |
|||
<t t-set="report_vehicle" t-value="service.vehicle_id" /> |
|||
<tr> |
|||
<th><span t-esc="service.vehicle_id.name" /></th> |
|||
<td colspan="7" /> |
|||
</tr> |
|||
</t> |
|||
<tr> |
|||
<td /> |
|||
<td><span t-esc="service.service_type_id.name" /></td> |
|||
<td><span t-esc="service.purchaser_id.name" /></td> |
|||
<td><span t-esc="service.date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="service.amount" t-options="{'widget': 'monetary', 'display_currency': service.currency_id}" /></td> |
|||
<td><span t-esc="service.odometer" /> <span t-if="service.odometer_unit"> |
|||
<t t-esc="dict(service.fields_get(allfields=['odometer_unit'])['odometer_unit']['selection'])[service.odometer_unit]" /> |
|||
</span> |
|||
</td> |
|||
<td><span t-esc="service.vendor_id.name" /></td> |
|||
<td><span t-esc="service.notes" /></td> |
|||
</tr> |
|||
<t t-set="service_cost" t-value="service_cost + service.amount" /> |
|||
<t t-set="total_cost" t-value="total_cost + service.amount" /> |
|||
</t> |
|||
<t t-if="report_vehicle"> |
|||
<tr> |
|||
<td colspan="1" /> |
|||
<th align="right">Service Cost</th> |
|||
<th><span t-esc="service_cost" t-options="{'widget': 'monetary', 'display_currency': service.currency_id}" /></th> |
|||
<td colspan="5" /> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" /> |
|||
<th align="right">Total Cost</th> |
|||
<th><span t-esc="total_cost" t-options="{'widget': 'monetary', 'display_currency': service.currency_id}" /></th> |
|||
<td colspan="5"/> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
|
|||
<t t-if="odometers"> |
|||
<p style="page-break-after:always;" /> |
|||
<h2>Odometers</h2> |
|||
<table name="odometers" class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Vehicle</th> |
|||
<th>Date</th> |
|||
<th>Driver</th> |
|||
<th>Odometer Value</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-set="report_vehicle" t-value="false" /> |
|||
<t t-foreach="odometers" t-as="odometer"> |
|||
<tr> |
|||
<t t-if="not report_vehicle or report_vehicle != odometer.vehicle_id"> |
|||
<t t-set="report_vehicle" t-value="odometer.vehicle_id" /> |
|||
<td><span t-esc="odometer.vehicle_id.name" /></td> |
|||
</t> |
|||
<t t-else=""> |
|||
<td/> |
|||
</t> |
|||
<td><span t-esc="odometer.date" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="odometer.driver_id.name" /></td> |
|||
<td><span t-esc="odometer.value" /> |
|||
<span t-if="odometer.unit"> |
|||
<t t-esc="dict(odometer.fields_get(allfields=['unit'])['unit']['selection'])[odometer.unit]" /> |
|||
</span> |
|||
</td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
|
|||
<t t-if="drivers_history"> |
|||
<p style="page-break-after:always;" /> |
|||
<h2>Drivers History</h2> |
|||
<table name="drivers_history" class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Vehicle</th> |
|||
<th>Driver</th> |
|||
<th>Start Date</th> |
|||
<th>End Date</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-set="report_vehicle" t-value="false" /> |
|||
<t t-foreach="drivers_history" t-as="history"> |
|||
<tr> |
|||
<t t-if="not report_vehicle or report_vehicle != history.vehicle_id"> |
|||
<t t-set="report_vehicle" t-value="history.vehicle_id" /> |
|||
<td><span t-esc="history.vehicle_id.name" /></td> |
|||
</t> |
|||
<t t-else=""> |
|||
<td/> |
|||
</t> |
|||
<td><span t-esc="history.driver_id.name" /></td> |
|||
<td><span t-esc="history.date_start" t-options="{'widget': 'date'}" /></td> |
|||
<td><span t-esc="history.date_end" t-options="{'widget': 'date'}" /></td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Report action --> |
|||
<record id="action_report_vehicle_detail" model="ir.actions.report"> |
|||
<field name="name">Fleet - Complete Report</field> |
|||
<field name="model">vehicle.detail</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">fleet_complete_report.report_vehicle_detail</field> |
|||
<field name="report_file">fleet_complete_report.report_vehicle_detail</field> |
|||
</record> |
|||
</odoo> |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 291 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 8.8 KiB |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import vehicle_detail |
@ -0,0 +1,110 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class VehicleDetail(models.TransientModel): |
|||
""" |
|||
Model for capturing and filtering vehicle details for report generation. |
|||
""" |
|||
_name = 'vehicle.detail' |
|||
_description = 'Vehicle Detail' |
|||
|
|||
vehicle_ids = fields.Many2many('fleet.vehicle', string='Vehicles', |
|||
domain="[('state_id', 'in', state_ids)]", |
|||
help="List of vehicles to generate report") |
|||
state_ids = fields.Many2many( |
|||
'fleet.vehicle.state', string='States', required=True, |
|||
help='States of the vehicle') |
|||
start_date = fields.Date( |
|||
string='Start Date', required=True, default=fields.Date.context_today, |
|||
help='Start date to filter the records') |
|||
end_date = fields.Date( |
|||
string='End Date', equired=True, default=fields.Date.context_today, |
|||
help='End date to filter the records') |
|||
exclude_vehicle_data = fields.Boolean( |
|||
string='Exclude Vehicle Data', default=True, |
|||
help='Enable this to hide the vehicle data in the report') |
|||
|
|||
@api.onchange('start_date') |
|||
def _onchange_start_date(self): |
|||
""" |
|||
Onchange method triggered when the start_date field is changed. |
|||
|
|||
This method ensures that the start_date is valid based on certain |
|||
conditions. |
|||
|
|||
:return: None |
|||
""" |
|||
if not self.end_date: |
|||
if self.start_date and self.start_date > fields.Date.context_today( |
|||
self): |
|||
self.start_date = fields.Date.context_today(self) |
|||
else: |
|||
if self.start_date and self.start_date > self.end_date: |
|||
self.start_date = self.end_date |
|||
|
|||
@api.onchange('end_date') |
|||
def _onchange_end_date(self): |
|||
""" |
|||
Onchange method triggered when the end_date field is changed. |
|||
|
|||
This method ensures that the end_date is valid based on certain |
|||
conditions. |
|||
|
|||
:return: None |
|||
""" |
|||
if self.start_date and self.end_date and \ |
|||
self.start_date > self.end_date: |
|||
self.end_date = self.start_date |
|||
if self.end_date and self.end_date > fields.Date.context_today(self): |
|||
self.end_date = fields.Date.context_today(self) |
|||
|
|||
@api.onchange('state_ids') |
|||
def _onchange_state_ids(self): |
|||
""" |
|||
Onchange method triggered when the state_ids field is changed. |
|||
|
|||
This method filters the vehicle_ids based on the selected state_ids. |
|||
|
|||
:return: None |
|||
""" |
|||
if self.state_ids: |
|||
self.vehicle_ids = self.vehicle_ids.filtered( |
|||
lambda vehicle: vehicle.state_id.id in self.state_ids.ids) |
|||
|
|||
def action_print_report(self): |
|||
""" |
|||
print PDF report for fleet based on selected data |
|||
:return: report action |
|||
""" |
|||
vehicles = self.vehicle_ids |
|||
if not self.vehicle_ids: |
|||
if self.state_ids: |
|||
vehicles = self.env['fleet.vehicle'].search( |
|||
[('state_id', 'in', self.state_ids.ids)]) |
|||
else: |
|||
vehicles = self.env['fleet.vehicle'].search([]) |
|||
data = {'vehicle_ids': vehicles.ids} |
|||
return self.env.ref( |
|||
'fleet_complete_report.action_report_vehicle_detail').report_action( |
|||
self, data=data) |
@ -0,0 +1,44 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<!-- Wizard form view --> |
|||
<record id="vehicle_detail_view_form" model="ir.ui.view"> |
|||
<field name="name">vehicle.detail.view.form</field> |
|||
<field name="model">vehicle.detail</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Vehicle Details"> |
|||
<group> |
|||
<group> |
|||
<field name="start_date" widget="date" /> |
|||
<field name="state_ids" widget="many2many_tags" /> |
|||
</group> |
|||
<group> |
|||
<field name="end_date" widget="date" /> |
|||
<field name="vehicle_ids" widget="many2many_tags" /> |
|||
<field name="exclude_vehicle_data" /> |
|||
</group> |
|||
</group> |
|||
<footer> |
|||
<button string="Print" name="action_print_report" |
|||
type="object" class="btn-primary" /> |
|||
<button string="Discard" class="btn-default" |
|||
special="cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<!-- Wizard action window --> |
|||
<record id="vehicle_detail_action" model="ir.actions.act_window"> |
|||
<field name="name">Vehicle Details</field> |
|||
<field name="res_model">vehicle.detail</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="vehicle_detail_view_form" /> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
<!-- Wizard Menu: Vehicle Details --> |
|||
<menuitem name="Vehicle Details" id="vehicle_detail_menu_action" |
|||
action="vehicle_detail_action" parent="fleet.menu_fleet_reporting" |
|||
groups="fleet.fleet_group_manager" sequence="2" /> |
|||
</odoo> |