Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] fieldservice_fleet: Migration to 15.0 #1107

Merged
merged 19 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions fieldservice_fleet/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/field-service/issues/1>`_.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/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 <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_fleet%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Brian McMaster
* Open Source Integrators

Contributors
~~~~~~~~~~~~

* Wolfgang Hall <whall@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Mohammad Khalid <mkhalid@opensourceintegrators.com>
* Brian McMaster <brian@mcmpest.com>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Open Source Integrators <https://opensourceintegrators.com>
* McMaster Lawn & Pest Services <https://www.mcmpest.com>

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-wolfhall| |maintainer-max3903| |maintainer-brian10048|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/14.0/fieldservice_fleet>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 7 additions & 0 deletions fieldservice_fleet/__init__.py
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions fieldservice_fleet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
57 changes: 57 additions & 0 deletions fieldservice_fleet/hooks.py
Original file line number Diff line number Diff line change
@@ -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")),
)
123 changes: 123 additions & 0 deletions fieldservice_fleet/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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 <info@konos.cl>\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"
Loading