-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[15.0][ADD] fleet_vehicle_service_activity: Create an activity for ve…
…hicle fleet manager when the service is close to the days previously set
- Loading branch information
1 parent
c1fd1af
commit 2cf8ffd
Showing
19 changed files
with
840 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
==================================================================== | ||
Create an activity to vehicle fleet manager days before service date | ||
==================================================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:f0eb3b3a7228dba7966792a2bd7b62656663a64fcb29e5b8cfe44efb8798f46a | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |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%2Ffleet-lightgray.png?logo=github | ||
:target: https://github.com/OCA/fleet/tree/15.0/fleet_vehicle_service_activity | ||
:alt: OCA/fleet | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/fleet-15-0/fleet-15-0-fleet_vehicle_service_activity | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/fleet&target_branch=15.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds the following features: | ||
|
||
- Set days before service date on Settings/Fleet Management. | ||
- Create an activity for vehicle fleet manager when the service is close to the days previously set. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/fleet/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/fleet/issues/new?body=module:%20fleet_vehicle_service_activity%0Aversion:%2015.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 | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa`: | ||
|
||
* Carolina Fernandez | ||
|
||
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. | ||
|
||
This module is part of the `OCA/fleet <https://github.com/OCA/fleet/tree/15.0/fleet_vehicle_service_activity>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2020-Present Druidoo - Manuel Marquez <manuel.marquez@druidoo.io> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2023 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Create an activity to vehicle fleet manager days before service date", | ||
"summary": "Activity alerts for fleet services", | ||
"category": "Human Resources/Fleet", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"development_status": "Production/Stable", | ||
"website": "https://github.com/OCA/fleet", | ||
"license": "AGPL-3", | ||
"version": "15.0.1.0.0", | ||
"depends": ["fleet"], | ||
"data": [ | ||
"data/fleet_data.xml", | ||
"data/mail_data.xml", | ||
"views/res_config_settings_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<record | ||
forcecreate="True" | ||
id="ir_cron_service_date_activity_generator" | ||
model="ir.cron" | ||
> | ||
<field name="name">Fleet: Generate service date activity</field> | ||
<field name="model_id" ref="model_fleet_vehicle_log_services" /> | ||
<field name="state">code</field> | ||
<field name="code">model._cron_manage_service_date()</field> | ||
<field name="user_id" ref="base.user_root" /> | ||
<field name="interval_number">1</field> | ||
<field name="interval_type">days</field> | ||
<field name="numbercall">-1</field> | ||
<field eval="False" name="doall" /> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<record id="mail_act_fleet_service_to_check" model="mail.activity.type"> | ||
<field name="name">Service to Check</field> | ||
<field name="icon">fa-car</field> | ||
<field name="res_model">fleet.vehicle.log.services</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * fleet_vehicle_service_activity | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-12-14 18:50+0000\n" | ||
"PO-Revision-Date: 2023-12-14 15:56-0300\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 3.4.1\n" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span class=\"o_form_label\">Date Service Activity</span>" | ||
msgstr "<span class=\"o_form_label\">Fecha Actividad del Servicio</span>" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span> days before date service</span>" | ||
msgstr "<span> días antes de la fecha del servicio</span>" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span>Create an activity </span>" | ||
msgstr "<span>Crear una actividad </span>" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model,name:fleet_vehicle_service_activity.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Opciones de configuración" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model.fields,field_description:fleet_vehicle_service_activity.field_res_config_settings__delay_alert_service | ||
msgid "Delay activity service outdated" | ||
msgstr "Retrasar alerta de servicio desactualizado" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.actions.server,name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator_ir_actions_server | ||
#: model:ir.cron,cron_name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator | ||
#: model:ir.cron,name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator | ||
msgid "Fleet: Generate service date activity" | ||
msgstr "Flota: Generar actividad de fecha de servicio" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:mail.activity.type,name:fleet_vehicle_service_activity.mail_act_fleet_service_to_check | ||
msgid "Service to Check" | ||
msgstr "Servicio para Comprobar" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model,name:fleet_vehicle_service_activity.model_fleet_vehicle_log_services | ||
msgid "Services for vehicles" | ||
msgstr "Servicios para los vehículos" |
58 changes: 58 additions & 0 deletions
58
fleet_vehicle_service_activity/i18n/fleet_vehicle_service_activity.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * fleet_vehicle_service_activity | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-12-14 18:47+0000\n" | ||
"PO-Revision-Date: 2023-12-14 18:47+0000\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: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span class=\"o_form_label\">Date Service Activity</span>" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span> days before date service</span>" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_service_activity.res_config_settings_view_form | ||
msgid "<span>Create an activity </span>" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model,name:fleet_vehicle_service_activity.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model.fields,field_description:fleet_vehicle_service_activity.field_res_config_settings__delay_alert_service | ||
msgid "Delay activity service outdated" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.actions.server,name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator_ir_actions_server | ||
#: model:ir.cron,cron_name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator | ||
#: model:ir.cron,name:fleet_vehicle_service_activity.ir_cron_service_date_activity_generator | ||
msgid "Fleet: Generate service date activity" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:mail.activity.type,name:fleet_vehicle_service_activity.mail_act_fleet_service_to_check | ||
msgid "Service to Check" | ||
msgstr "" | ||
|
||
#. module: fleet_vehicle_service_activity | ||
#: model:ir.model,name:fleet_vehicle_service_activity.model_fleet_vehicle_log_services | ||
msgid "Services for vehicles" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2023 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import res_config_settings | ||
from . import fleet_vehicle_log_services |
41 changes: 41 additions & 0 deletions
41
fleet_vehicle_service_activity/models/fleet_vehicle_log_services.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2023 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from dateutil.relativedelta import relativedelta | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class FleetVehicleLogServices(models.Model): | ||
_inherit = "fleet.vehicle.log.services" | ||
|
||
@api.model | ||
def _cron_manage_service_date(self): | ||
params = self.env["ir.config_parameter"].sudo() | ||
delay_alert_service = int( | ||
params.get_param("hr_fleet.delay_alert_service", default=30) | ||
) | ||
date_today = fields.Date.today() | ||
outdated_days = date_today + relativedelta(days=+delay_alert_service) | ||
reminder_activity_type = ( | ||
self.env.ref( | ||
"fleet_vehicle_service_activity.mail_act_fleet_service_to_check", | ||
raise_if_not_found=False, | ||
) | ||
or self.env["mail.activity.type"] | ||
) | ||
nearly_date_services = self.search( | ||
[ | ||
("state", "in", ("new", "running")), | ||
("date", "<", outdated_days), | ||
("vehicle_id.manager_id", "!=", False), | ||
] | ||
).filtered( | ||
lambda nec: reminder_activity_type not in nec.activity_ids.activity_type_id | ||
) | ||
for service in nearly_date_services: | ||
service.activity_schedule( | ||
"fleet_vehicle_service_activity.mail_act_fleet_service_to_check", | ||
service.date, | ||
user_id=service.vehicle_id.manager_id.id, | ||
) |
14 changes: 14 additions & 0 deletions
14
fleet_vehicle_service_activity/models/res_config_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = ["res.config.settings"] | ||
|
||
delay_alert_service = fields.Integer( | ||
string="Delay activity service outdated", | ||
default=30, | ||
config_parameter="hr_fleet.delay_alert_service", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Tecnativa`: | ||
|
||
* Carolina Fernandez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This module adds the following features: | ||
|
||
- Set days before service date on Settings/Fleet Management. | ||
- Create an activity for vehicle fleet manager when the service is close to the days previously set. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.