diff --git a/fieldservice_fleet/README.rst b/fieldservice_fleet/README.rst new file mode 100644 index 0000000000..7c9400c034 --- /dev/null +++ b/fieldservice_fleet/README.rst @@ -0,0 +1,146 @@ +=================== +Field Service Fleet +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github + :target: https://github.com/OCA/field-service/tree/14.0/fieldservice_fleet + :alt: OCA/field-service +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_fleet + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/264/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to link the vehicles and workers of Field Service with vehicles and drivers of Fleet. + +Beware that the Fleet module can have more vehicles than the FSM one (not all vehicles of the company are used for Field Service work). + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install Field Service and have the mapping features, you need to install GeoEngine. + +Please refer to the installation instructions available at: +https://github.com/OCA/geospatial/tree/13.0/base_geoengine + +Configuration +============= + +Upon installation, any existing FSM Vehicles will have Fleet vehicles created for them. + +Go to Fleet and review the vehicles created from the existing FSM vehicles + +* Update the vehicle model as needed +* Update the odometer unit which is set to kilometers by default + +Usage +===== + +To use this module, you need to: + +Fleet + + * Go to Fleet + * Create or select a vehicle + * From Action menu, choose Convert to FSM Vehicle + * A new FSM Vehicle will be created linked to this Fleet Vehicle + +Field Service + + * Go to Field Service > Master Data > Vehicles + * Select or create a vehicle. + * Link to a Fleet Vehicle by assigining one to the vehicle details + +Changing the Fleet vehicle driver sets the FSM Vehicle worker +Changing the FSM Vehicle worker sets the Fleet Vehicle driver + +Known issues / Roadmap +====================== + +The roadmap of the Field Service application is documented on +`Github `_. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Brian McMaster +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* Wolfgang Hall +* Maxime Chambreuil +* Mohammad Khalid +* Brian McMaster + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Open Source Integrators +* McMaster Lawn & Pest Services + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px + :target: https://github.com/wolfhall + :alt: wolfhall +.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 +.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px + :target: https://github.com/brian10048 + :alt: brian10048 + +Current `maintainers `__: + +|maintainer-wolfhall| |maintainer-max3903| |maintainer-brian10048| + +This module is part of the `OCA/field-service `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_fleet/__init__.py b/fieldservice_fleet/__init__.py new file mode 100644 index 0000000000..05208c5649 --- /dev/null +++ b/fieldservice_fleet/__init__.py @@ -0,0 +1,7 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import wizard +from .hooks import pre_init_hook diff --git a/fieldservice_fleet/__manifest__.py b/fieldservice_fleet/__manifest__.py new file mode 100644 index 0000000000..c70e00b868 --- /dev/null +++ b/fieldservice_fleet/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Field Service Fleet", + "summary": "Link Field Service vehicles with Odoo Fleet", + "version": "15.0.1.0.0", + "category": "Field Service", + "author": "Brian McMaster, " + "Open Source Integrators, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/field-service", + "depends": ["fieldservice_vehicle", "fleet"], + "data": [ + "security/ir.model.access.csv", + "views/fsm_vehicle.xml", + "views/fleet_vehicle.xml", + "wizard/fsm_fleet_wizard.xml", + ], + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": ["wolfhall", "max3903", "brian10048"], + "pre_init_hook": "pre_init_hook", + "installable": True, +} diff --git a/fieldservice_fleet/hooks.py b/fieldservice_fleet/hooks.py new file mode 100644 index 0000000000..9cac4e4978 --- /dev/null +++ b/fieldservice_fleet/hooks.py @@ -0,0 +1,57 @@ +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import SUPERUSER_ID, api + + +def pre_init_hook(cr): + # Check for existing fsm vehicles + cr.execute("SELECT * FROM fsm_vehicle") + vehicles = [] + vehicles = cr.dictfetchall() + if vehicles: + # Get a fleet vehicle model to set on the new Fleet vehicle(s) + env = api.Environment(cr, SUPERUSER_ID, {}) + model_id = env["fleet.vehicle.model"].search([], limit=1).id + # Create a new Fleet vehicle for each FSM vehicle + for veh in vehicles: + # Get the FSM worker to set as the Fleet driver + fsm_person_id = veh.get("person_id", False) + driver_id = False + if fsm_person_id: + driver_id = env["fsm.person"].browse(fsm_person_id).partner_id.id + cr.execute( + """ + INSERT INTO fleet_vehicle ( + name, + model_id, + driver_id, + is_fsm_vehicle, + odometer_unit, + active) + VALUES ( + %s, + %s, + %s, + True, + 'kilometers', + True);""", + (veh.get("name"), model_id, driver_id), + ) + # Set this new Fleet vehicle on the existing FSM vehicle + cr.execute( + """ + SELECT id + FROM fleet_vehicle + ORDER BY id desc + LIMIT 1 + """ + ) + fleet = cr.dictfetchone() + cr.execute( + """ + UPDATE fsm_vehicle + SET fleet_vehicle_id = %s + WHERE id = %s;""", + (fleet.get("id"), veh.get("id")), + ) diff --git a/fieldservice_fleet/i18n/es.po b/fieldservice_fleet/i18n/es.po new file mode 100644 index 0000000000..4b31bb02a5 --- /dev/null +++ b/fieldservice_fleet/i18n/es.po @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-01-03 05:13+0000\n" +"Last-Translator: Nelson Ram??rez S??nchez \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" +"Ya existe un veh??culo de servicio de campo relacionado con ese veh??culo de " +"la flota." + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "" +"Convierta este registro de veh??culo en un veh??culo de servicio de campo." + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "Convertir a Veh??culo FSM" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "Convertir a un veh??culo de servicio de campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "Nombre para Mostrar" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "Conversi??n de veh??culos de flota FSM" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "El veh??culo FSM solo se puede vincular a un veh??culo de flota" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "??Se utiliza para servicio de campo?" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "Detalles del Veh??culo" diff --git a/fieldservice_fleet/i18n/es_AR.po b/fieldservice_fleet/i18n/es_AR.po new file mode 100644 index 0000000000..cd85d70fdc --- /dev/null +++ b/fieldservice_fleet/i18n/es_AR.po @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-01-17 06:05+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" +"Ya existe un Vehículo de Servicio de Campo relacionado con ese vehículo de " +"flota." + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "Cancelar" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "Convertir" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "" +"Convierte este registro de vehículo en un Vehículo de Servicio de Campo." + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "Convertir a Vehículo FSM" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "Convertir a un Vehículo de Servicio de Campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "Conversión de Vehículos de Flota de FSM" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "El vehículo FSM solo se puede vincular a un vehículo de la flota" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "Vehículo del Servicio de Campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "¿Es usado para Servicio de Campo?" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "Última Actualización por" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "Última Actualización en" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "Vehículo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "Detalles de Vehículo" diff --git a/fieldservice_fleet/i18n/es_CL.po b/fieldservice_fleet/i18n/es_CL.po new file mode 100644 index 0000000000..a1b07f41be --- /dev/null +++ b/fieldservice_fleet/i18n/es_CL.po @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-01-03 05:13+0000\n" +"Last-Translator: Nelson Ram??rez S??nchez \n" +"Language-Team: none\n" +"Language: es_CL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" +"Ya existe un veh??culo de servicio de campo relacionado con ese veh??culo de " +"la flota." + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "" +"Convierta este registro de veh??culo en un veh??culo de servicio de campo." + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "Convertir a Veh??culo FSM" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "Convertir a un veh??culo de servicio de campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "Nombre para Mostrar" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "Conversi??n de veh??culos de flota FSM" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "El veh??culo FSM solo se puede vincular a un veh??culo de flota" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "??Se utiliza para servicio de campo?" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "Detalles del Veh??culo" diff --git a/fieldservice_fleet/i18n/fieldservice_fleet.pot b/fieldservice_fleet/i18n/fieldservice_fleet.pot new file mode 100644 index 0000000000..4abb7cc9c1 --- /dev/null +++ b/fieldservice_fleet/i18n/fieldservice_fleet.pot @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "" diff --git a/fieldservice_fleet/i18n/it.po b/fieldservice_fleet/i18n/it.po new file mode 100644 index 0000000000..764ea5e2a0 --- /dev/null +++ b/fieldservice_fleet/i18n/it.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-11-16 18:45+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" +"Un veicolo di assistenza sul campo è già associato a quel veicolo della " +"flotta." + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "Annulla" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "Converti" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "Converti questo veicolo in un veicolo di assistenza sul campo." + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "Converti in veicolo FSM" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "Converti in un veicolo di assistenza sul campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "Conversione veicolo della flotta FSM" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "Un veicolo FSM piuò essere collegato ad un solo veicolo della flotta" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "Veicolo assistenza sul campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "È utilizzato per assistenza sul campo?" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "Veicolo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "Dettagli veicolo" diff --git a/fieldservice_fleet/i18n/pt_BR.po b/fieldservice_fleet/i18n/pt_BR.po new file mode 100644 index 0000000000..20ea33d227 --- /dev/null +++ b/fieldservice_fleet/i18n/pt_BR.po @@ -0,0 +1,125 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_fleet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-06-17 16:19+0000\n" +"Last-Translator: Fernando Colus \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_fleet +#: code:addons/fieldservice_fleet/wizard/fsm_fleet_wizard.py:0 +#, python-format +msgid "A Field Service Vehicle related to that Fleet Vehicle already exists." +msgstr "" +"Um Ve??culo de Servi??o de Campo relacionado a esse Ve??culo de Frota j?? " +"existe." + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Cancel" +msgstr "Cancelar" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert" +msgstr "Converter" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert this vehicle record into a Field Service Vehicle." +msgstr "" +"Converta este registro do ve??culo em um Ve??culo de Servi??o de Campo." + +#. module: fieldservice_fleet +#: model:ir.actions.act_window,name:fieldservice_fleet.vehicle_fsm_action +msgid "Convert to FSM Vehicle" +msgstr "Converter em ve??culo FSM" + +#. module: fieldservice_fleet +#: model_terms:ir.ui.view,arch_db:fieldservice_fleet.vehicle_wizard_view +msgid "Convert to a Field Service Vehicle" +msgstr "Converter em um Ve??culo de Servi??o de Campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_uid +msgid "Created by" +msgstr "Criado por" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__create_date +msgid "Created on" +msgstr "Criado em" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__display_name +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__display_name +msgid "Display Name" +msgstr "Nome Exibido" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_fleet_wizard +msgid "FSM Fleet Vehicle Conversion" +msgstr "Convers??o de ve??culo de frota FSM (Field Services Management)" + +#. module: fieldservice_fleet +#: model:ir.model.constraint,message:fieldservice_fleet.constraint_fsm_vehicle_fsm_vehicle_fleet_uniq +msgid "FSM vehicle can only be linked to one fleet vehicle" +msgstr "" +"O ve??culo no FSM (Field Services Management) s?? pode ser vinculado a um ??" +"nico ve??culo da frota" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fsm_vehicle +msgid "Field Service Vehicle" +msgstr "Ve??culo de Servi??o de Campo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__id +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle__is_fsm_vehicle +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__is_fsm_vehicle +msgid "Is used for Field Service?" +msgstr "?? usado para Servi??o de Campo?" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fleet_vehicle____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard____last_update +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle____last_update +msgid "Last Modified on" +msgstr "??ltima Modifica????o Feita em" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_uid +msgid "Last Updated by" +msgstr "??ltima Atualiza????o por" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_fleet_wizard__write_date +msgid "Last Updated on" +msgstr "??ltima Atualiza????o em" + +#. module: fieldservice_fleet +#: model:ir.model,name:fieldservice_fleet.model_fleet_vehicle +msgid "Vehicle" +msgstr "Ve??culo" + +#. module: fieldservice_fleet +#: model:ir.model.fields,field_description:fieldservice_fleet.field_fsm_vehicle__fleet_vehicle_id +msgid "Vehicle Details" +msgstr "Detalhes do Ve??culo" diff --git a/fieldservice_fleet/models/__init__.py b/fieldservice_fleet/models/__init__.py new file mode 100644 index 0000000000..9c4a2db24b --- /dev/null +++ b/fieldservice_fleet/models/__init__.py @@ -0,0 +1,8 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import ( + fsm_vehicle, + fleet_vehicle, +) diff --git a/fieldservice_fleet/models/fleet_vehicle.py b/fieldservice_fleet/models/fleet_vehicle.py new file mode 100644 index 0000000000..24038b961c --- /dev/null +++ b/fieldservice_fleet/models/fleet_vehicle.py @@ -0,0 +1,30 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FleetVehicle(models.Model): + _inherit = "fleet.vehicle" + + is_fsm_vehicle = fields.Boolean(string="Is used for Field Service?") + + def set_fsm_driver(self): + self.ensure_one() + if self.driver_id and self.is_fsm_vehicle: + driver_partner = self.driver_id + fsm_worker = self.env["fsm.person"].search( + [("partner_id", "=", driver_partner.id)] + ) + if not fsm_worker: + # Create FSM worker + fsm_worker = self.env["fsm.person"].create( + {"partner_id": driver_partner.id} + ) + driver_partner.write({"fsm_person": True}) + fsm_vehicle = self.env["fsm.vehicle"].search( + [("fleet_vehicle_id", "=", self.id)] + ) + # Assign the worker to the FSM vehicle + fsm_vehicle.person_id = fsm_worker diff --git a/fieldservice_fleet/models/fsm_vehicle.py b/fieldservice_fleet/models/fsm_vehicle.py new file mode 100644 index 0000000000..e20389e598 --- /dev/null +++ b/fieldservice_fleet/models/fsm_vehicle.py @@ -0,0 +1,48 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FSMVehicle(models.Model): + _inherit = "fsm.vehicle" + _inherits = {"fleet.vehicle": "fleet_vehicle_id"} + + fleet_vehicle_id = fields.Many2one( + "fleet.vehicle", + string="Vehicle Details", + required=True, + ondelete="restrict", + ) + + _sql_constraints = [ + ( + "fsm_vehicle_fleet_uniq", + "unique(id,fleet_vehicle_id)", + "FSM vehicle can only be linked to one fleet vehicle", + ) + ] + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + fleet_id = vals.get("fleet_vehicle_id") + if fleet_id: + if vals.get("person_id", False): + vals["driver_id"] = vals.get("person_id") + vals["is_fsm_vehicle"] = True + return super(FSMVehicle, self).create(vals_list) + + def write(self, vals): + # update fsm.vehicle worker based on the fleet.vehicle driver + if "driver_id" in vals: + for vehicle in self: + if vehicle.is_fsm_vehicle: + vehicle.fleet_vehicle_id.set_fsm_driver() + # update fleet.vehicle driver based on the fsm.vehicle worker + fsm_worker_id = vals.get("person_id", False) + if fsm_worker_id: + worker_partner = self.env["fsm.person"].browse(fsm_worker_id).partner_id + vals.update({"driver_id": worker_partner.id}) + return super().write(vals) diff --git a/fieldservice_fleet/readme/CONFIGURE.rst b/fieldservice_fleet/readme/CONFIGURE.rst new file mode 100644 index 0000000000..b47631caad --- /dev/null +++ b/fieldservice_fleet/readme/CONFIGURE.rst @@ -0,0 +1,6 @@ +Upon installation, any existing FSM Vehicles will have Fleet vehicles created for them. + +Go to Fleet and review the vehicles created from the existing FSM vehicles + +* Update the vehicle model as needed +* Update the odometer unit which is set to kilometers by default diff --git a/fieldservice_fleet/readme/CONTRIBUTORS.rst b/fieldservice_fleet/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..c6f5891683 --- /dev/null +++ b/fieldservice_fleet/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Wolfgang Hall +* Maxime Chambreuil +* Mohammad Khalid +* Brian McMaster diff --git a/fieldservice_fleet/readme/CREDITS.rst b/fieldservice_fleet/readme/CREDITS.rst new file mode 100644 index 0000000000..367a40890a --- /dev/null +++ b/fieldservice_fleet/readme/CREDITS.rst @@ -0,0 +1,4 @@ +The development of this module has been financially supported by: + +* Open Source Integrators +* McMaster Lawn & Pest Services diff --git a/fieldservice_fleet/readme/DESCRIPTION.rst b/fieldservice_fleet/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..7f3c1d1097 --- /dev/null +++ b/fieldservice_fleet/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows you to link the vehicles and workers of Field Service with vehicles and drivers of Fleet. + +Beware that the Fleet module can have more vehicles than the FSM one (not all vehicles of the company are used for Field Service work). diff --git a/fieldservice_fleet/readme/INSTALL.rst b/fieldservice_fleet/readme/INSTALL.rst new file mode 100644 index 0000000000..e5355c4b0f --- /dev/null +++ b/fieldservice_fleet/readme/INSTALL.rst @@ -0,0 +1,4 @@ +To install Field Service and have the mapping features, you need to install GeoEngine. + +Please refer to the installation instructions available at: +https://github.com/OCA/geospatial/tree/13.0/base_geoengine diff --git a/fieldservice_fleet/readme/ROADMAP.rst b/fieldservice_fleet/readme/ROADMAP.rst new file mode 100644 index 0000000000..f607015959 --- /dev/null +++ b/fieldservice_fleet/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/fieldservice_fleet/readme/USAGE.rst b/fieldservice_fleet/readme/USAGE.rst new file mode 100644 index 0000000000..505490587a --- /dev/null +++ b/fieldservice_fleet/readme/USAGE.rst @@ -0,0 +1,17 @@ +To use this module, you need to: + +Fleet + + * Go to Fleet + * Create or select a vehicle + * From Action menu, choose Convert to FSM Vehicle + * A new FSM Vehicle will be created linked to this Fleet Vehicle + +Field Service + + * Go to Field Service > Master Data > Vehicles + * Select or create a vehicle. + * Link to a Fleet Vehicle by assigining one to the vehicle details + +Changing the Fleet vehicle driver sets the FSM Vehicle worker +Changing the FSM Vehicle worker sets the Fleet Vehicle driver diff --git a/fieldservice_fleet/security/ir.model.access.csv b/fieldservice_fleet/security/ir.model.access.csv new file mode 100644 index 0000000000..39dd4e2fa7 --- /dev/null +++ b/fieldservice_fleet/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_fsm_fleet_wizard_manager,fsm.fleet.wizard.manager,model_fsm_fleet_wizard,fieldservice.group_fsm_manager,1,1,1,1 +access_fsm_fleet_wizard_user,fsm.fleet.wizard.user,model_fsm_fleet_wizard,fieldservice.group_fsm_user,1,0,0,0 diff --git a/fieldservice_fleet/static/description/icon.png b/fieldservice_fleet/static/description/icon.png new file mode 100644 index 0000000000..955674d8f0 Binary files /dev/null and b/fieldservice_fleet/static/description/icon.png differ diff --git a/fieldservice_fleet/static/description/index.html b/fieldservice_fleet/static/description/index.html new file mode 100644 index 0000000000..dedf37a24c --- /dev/null +++ b/fieldservice_fleet/static/description/index.html @@ -0,0 +1,482 @@ + + + + + + +Field Service Fleet + + + +
+

Field Service Fleet

+ + +

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runbot

+

This module allows you to link the vehicles and workers of Field Service with vehicles and drivers of Fleet.

+

Beware that the Fleet module can have more vehicles than the FSM one (not all vehicles of the company are used for Field Service work).

+

Table of contents

+ +
+

Installation

+

To install Field Service and have the mapping features, you need to install GeoEngine.

+

Please refer to the installation instructions available at: +https://github.com/OCA/geospatial/tree/13.0/base_geoengine

+
+
+

Configuration

+

Upon installation, any existing FSM Vehicles will have Fleet vehicles created for them.

+

Go to Fleet and review the vehicles created from the existing FSM vehicles

+
    +
  • Update the vehicle model as needed
  • +
  • Update the odometer unit which is set to kilometers by default
  • +
+
+
+

Usage

+

To use this module, you need to:

+

Fleet

+
+
    +
  • Go to Fleet
  • +
  • Create or select a vehicle
  • +
  • From Action menu, choose Convert to FSM Vehicle
  • +
  • A new FSM Vehicle will be created linked to this Fleet Vehicle
  • +
+
+

Field Service

+
+
    +
  • Go to Field Service > Master Data > Vehicles
  • +
  • Select or create a vehicle.
  • +
  • Link to a Fleet Vehicle by assigining one to the vehicle details
  • +
+
+

Changing the Fleet vehicle driver sets the FSM Vehicle worker +Changing the FSM Vehicle worker sets the Fleet Vehicle driver

+
+
+

Known issues / Roadmap

+

The roadmap of the Field Service application is documented on +Github.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Brian McMaster
  • +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainers:

+

wolfhall max3903 brian10048

+

This module is part of the OCA/field-service project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/fieldservice_fleet/tests/__init__.py b/fieldservice_fleet/tests/__init__.py new file mode 100644 index 0000000000..2c297e3189 --- /dev/null +++ b/fieldservice_fleet/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_fsm_fleet_wizard diff --git a/fieldservice_fleet/tests/test_fsm_fleet_wizard.py b/fieldservice_fleet/tests/test_fsm_fleet_wizard.py new file mode 100644 index 0000000000..ca7f5e83ca --- /dev/null +++ b/fieldservice_fleet/tests/test_fsm_fleet_wizard.py @@ -0,0 +1,124 @@ +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.exceptions import UserError +from odoo.tests.common import TransactionCase, new_test_user + +from odoo.addons.fieldservice_fleet import hooks + + +class TestFSMFleetWizard(TransactionCase): + def setUp(self): + super(TestFSMFleetWizard, self).setUp() + self.Wizard = self.env["fsm.fleet.wizard"] + self.fleet_vehicle_1 = self.env.ref("fleet.vehicle_1") + self.person_1 = self.env.ref("fieldservice.person_1") + self.driver_1 = self.env.ref("base.res_partner_address_25") + + def test_convert_vehicle(self): + # Convert a Fleet vehicle to FSM vehicle and link it + self.Wizard.action_convert_vehicle(self.fleet_vehicle_1) + + # Search FSM vehicle records linked to the test Fleet vehicle + fsm_vehicle = self.env["fsm.vehicle"].search( + [("fleet_vehicle_id", "=", self.fleet_vehicle_1.id)] + ) + + # Create a driver partner without an associated fsm.person record + driver_partner = self.env["res.partner"].create( + { + "name": "Driver Partner", + } + ) + + # Retrieve the fsm_worker record for the driver partner + fsm_worker = self.env["fsm.person"].search( + [("partner_id", "=", driver_partner.id)] + ) + + self.assertEqual( + len(fsm_vehicle), + 1, + """FSM Fleet Wizard: Did not find FSM vehicle + linked to Fleet vehicle""", + ) + self.assertEqual( + fsm_vehicle.name, + self.fleet_vehicle_1.name, + """FSM Fleet Wizard: FSM Vehicle and Fleet Vehicle + names do not match""", + ) + self.assertTrue( + self.fleet_vehicle_1.is_fsm_vehicle, + """FSM Fleet Wizard: Fleet vehicle boolean field + is_fsm_vehicle is False""", + ) + self.assertEqual( + fsm_vehicle.person_id.partner_id, + self.fleet_vehicle_1.driver_id, + """FSM Fleet Wizard: FSM vehicle driver is not same + as the Fleet vehicle driver""", + ) + self.assertTrue( + self.fleet_vehicle_1.driver_id and self.fleet_vehicle_1.is_fsm_vehicle, + "Driver ID and is_fsm_vehicle condition is not True", + ) + + # Set the driver_id of the fleet vehicle to the driver partner + self.fleet_vehicle_1.driver_id = driver_partner.id + + # Assert that fsm_worker is not found + self.assertFalse( + fsm_worker, "FSM worker found for driver partner, but it should not exist" + ) + + # Attempt to convert the Fleet vehicle again, but expect UserError + # because we already converted it + with self.assertRaises(UserError): + self.Wizard.action_convert_vehicle(self.fleet_vehicle_1) + + def test_fsm_vehicle(self): + self.fleet_vehicle_2 = self.env["fsm.vehicle"].create( + { + "name": "Vehicle 2", + "person_id": self.person_1.id, + "fleet_vehicle_id": self.fleet_vehicle_1.id, + } + ) + self.fleet_vehicle_1.is_fsm_vehicle = True + self.fleet_vehicle_2.write({"driver_id": self.driver_1.id}) + manager = new_test_user( + self.env, + "test fleet manager", + groups="fleet.fleet_group_manager,base.group_partner_manager", + ) + user = new_test_user(self.env, "test base user", groups="base.group_user") + brand = self.env["fleet.vehicle.model.brand"].create( + { + "name": "Audi", + } + ) + model = self.env["fleet.vehicle.model"].create( + { + "brand_id": brand.id, + "name": "A3", + } + ) + hooks.pre_init_hook(self.env.cr) + self.fleet_vehicle_3 = ( + self.env["fleet.vehicle"] + .with_user(manager) + .create( + { + "model_id": model.id, + "driver_id": user.partner_id.id, + "plan_to_change_car": False, + } + ) + ) + self.context = { + "active_model": "fleet.vehicle", + "active_ids": [self.fleet_vehicle_3.id], + "active_id": self.fleet_vehicle_3.id, + } + self.Wizard.with_context(**self.context).action_convert() diff --git a/fieldservice_fleet/views/fleet_vehicle.xml b/fieldservice_fleet/views/fleet_vehicle.xml new file mode 100644 index 0000000000..be3d87fc7e --- /dev/null +++ b/fieldservice_fleet/views/fleet_vehicle.xml @@ -0,0 +1,12 @@ + + + fleet.vehicle.form.fsm + fleet.vehicle + + + + + + + + diff --git a/fieldservice_fleet/views/fsm_vehicle.xml b/fieldservice_fleet/views/fsm_vehicle.xml new file mode 100644 index 0000000000..caa1268dbd --- /dev/null +++ b/fieldservice_fleet/views/fsm_vehicle.xml @@ -0,0 +1,12 @@ + + + fsm.vehicle.form.fleet + fsm.vehicle + + + + + + + + diff --git a/fieldservice_fleet/wizard/__init__.py b/fieldservice_fleet/wizard/__init__.py new file mode 100644 index 0000000000..510adba741 --- /dev/null +++ b/fieldservice_fleet/wizard/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import fsm_fleet_wizard diff --git a/fieldservice_fleet/wizard/fsm_fleet_wizard.py b/fieldservice_fleet/wizard/fsm_fleet_wizard.py new file mode 100644 index 0000000000..2756300c1c --- /dev/null +++ b/fieldservice_fleet/wizard/fsm_fleet_wizard.py @@ -0,0 +1,44 @@ +# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, models +from odoo.exceptions import UserError + + +class FSMFleetWizard(models.TransientModel): + """ + A wizard to convert a fleet.vehicle record to a fsm.vehicle + """ + + _name = "fsm.fleet.wizard" + _description = "FSM Fleet Vehicle Conversion" + + def action_convert(self): + vehicles = self.env["fleet.vehicle"].browse(self._context.get("active_ids", [])) + for vehicle in vehicles: + self.action_convert_vehicle(vehicle) + return {"type": "ir.actions.act_window_close"} + + def _prepare_fsm_vehicle(self, vehicle): + return { + "fleet_vehicle_id": vehicle.id, + "name": vehicle.name, + } + + def action_convert_vehicle(self, vehicle): + res = self.env["fsm.vehicle"].search_count( + [("fleet_vehicle_id", "=", vehicle.id)] + ) + if res == 0: + vals = self._prepare_fsm_vehicle(vehicle) + self.env["fsm.vehicle"].create(vals) + vehicle.write({"is_fsm_vehicle": True}) + vehicle.set_fsm_driver() + else: + raise UserError( + _( + "A Field Service Vehicle related to that" + " Fleet Vehicle already exists." + ) + ) diff --git a/fieldservice_fleet/wizard/fsm_fleet_wizard.xml b/fieldservice_fleet/wizard/fsm_fleet_wizard.xml new file mode 100644 index 0000000000..e5df8f499f --- /dev/null +++ b/fieldservice_fleet/wizard/fsm_fleet_wizard.xml @@ -0,0 +1,35 @@ + + + + Convert to FSM Vehicle + fsm.fleet.wizard + form + new + + + + + + Convert to a FSM Vehicle + fsm.fleet.wizard + +
+
+ Convert this vehicle record into a Field Service Vehicle. +
+ +
+
+
+
diff --git a/setup/fieldservice_fleet/odoo/addons/fieldservice_fleet b/setup/fieldservice_fleet/odoo/addons/fieldservice_fleet new file mode 120000 index 0000000000..18d39b0074 --- /dev/null +++ b/setup/fieldservice_fleet/odoo/addons/fieldservice_fleet @@ -0,0 +1 @@ +../../../../fieldservice_fleet \ No newline at end of file diff --git a/setup/fieldservice_fleet/setup.py b/setup/fieldservice_fleet/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/fieldservice_fleet/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)