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

[MIG][12.0] fleet vehicle service kanban: Backport 13.0 to 12.0 #12

Merged
merged 4 commits into from
Jun 17, 2020
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
95 changes: 95 additions & 0 deletions fleet_vehicle_service_kanban/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
====================================
Kanban Features for Vehicle Services
====================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| 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
.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Ffleet-lightgray.png?logo=github
:target: https://github.com/OCA/fleet/tree/12.0/fleet_vehicle_service_kanban
:alt: OCA/fleet
.. |badge3| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/fleet-12-0/fleet-12-0-fleet_vehicle_service_kanban
:alt: Translate me on Weblate
.. |badge4| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/291/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4|

This module adds the following features to vehicle services (fleet.vehicle.log.service):

- Kanban view.
- Features of mail (chatter) and acitivities, includes a new activity view.
- Configurable activity types. Menu under `Fleet / Configuration / Services Logs / Activity Types`.
- New fields: Responsible, Priority, Tags, Active, Stage.
- Configurable stages. Menu under `Fleet / Configuration / Services Logs / Vehicle Services Stages`.
- Configurable tags. Menu under `Fleet / Configuration / Services Logs / Vehicle Services Tags`.

**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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/fleet/issues/new?body=module:%20fleet_vehicle_service_kanban%0Aversion:%2012.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
~~~~~~~

* Druidoo

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

* `Druidoo <https://www.druidoo.io>`_:

* Iván Todorovich <[email protected]>
* Manuel Marquez <[email protected]>

* `PnLUG - Gruppo Odoo <https://odoo.pnlug.it>`_:

* Stefano Consolaro <[email protected]> (backport 13.0→12.0)

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-mamcode| image:: https://github.com/mamcode.png?size=40px
:target: https://github.com/mamcode
:alt: mamcode
.. |maintainer-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px
:target: https://github.com/ivantodorovich
:alt: ivantodorovich

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-mamcode| |maintainer-ivantodorovich|

This module is part of the `OCA/fleet <https://github.com/OCA/fleet/tree/12.0/fleet_vehicle_service_kanban>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions fleet_vehicle_service_kanban/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
26 changes: 26 additions & 0 deletions fleet_vehicle_service_kanban/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Kanban Features for Vehicle Services",
"summary": "Add features of kanban to logs of vehicle services.",
"category": "Human Resources/Fleet",
"author": "Druidoo, Odoo Community Association (OCA)",
"maintainers": ["mamcode", "ivantodorovich"],
"development_status": "Stable",
"website": "https://github.com/OCA/fleet",
"license": "AGPL-3",
"version": "12.0.1.0.0",
"depends": ["fleet", "mail"],
"data": [
"security/ir.model.access.csv",
"data/fleet_vehicle_log_services_stage_data.xml",
"data/mail_message_subtype_data.xml",
"views/fleet_vehicle_log_services_views.xml",
"views/fleet_vehicle_log_services_stage_views.xml",
"views/fleet_vehicle_log_services_tag_views.xml",
"views/fleet_service_type_views.xml",
"views/mail_activity_type_views.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record
id="fleet_vehicle_log_services_stage_draft"
model="fleet.vehicle.log.services.stage"
>
<field name="name">Draft</field>
<field name="sequence">1</field>
</record>
</odoo>
33 changes: 33 additions & 0 deletions fleet_vehicle_service_kanban/data/mail_message_subtype_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record
id="mail_message_subtype_fleet_service_purchaser_updated"
model="mail.message.subtype"
>
<field name="name">Changed Purchaser</field>
<field name="sequence">0</field>
<field name="res_model">fleet.vehicle.log.services</field>
<field name="default" eval="True" />
<field name="description">Changed Purchaser</field>
</record>
<record
id="mail_message_subtype_fleet_service_vendor_updated"
model="mail.message.subtype"
>
<field name="name">Changed Vendor</field>
<field name="sequence">1</field>
<field name="res_model">fleet.vehicle.log.services</field>
<field name="default" eval="True" />
<field name="description">Changed Vendor</field>
</record>
<record
id="mail_message_subtype_fleet_service_user_updated"
model="mail.message.subtype"
>
<field name="name">Changed Responsible</field>
<field name="sequence">2</field>
<field name="res_model">fleet.vehicle.log.services</field>
<field name="default" eval="True" />
<field name="description">Changed Responsible</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions fleet_vehicle_service_kanban/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import fleet_vehicle_log_services
from . import fleet_vehicle_log_services_stage
from . import fleet_vehicle_log_services_tag
68 changes: 68 additions & 0 deletions fleet_vehicle_service_kanban/models/fleet_vehicle_log_services.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class FleetVehicleLogServices(models.Model):
_name = "fleet.vehicle.log.services"
_inherit = ["fleet.vehicle.log.services", "mail.thread", "mail.activity.mixin"]
_description = "Services for vehicles"

def _default_stage(self):
stage = self.env.ref(
"fleet_vehicle_service_kanban.fleet_vehicle_log_services_stage_draft",
raise_if_not_found=False,
)
return stage if stage and stage.id else False

stage_id = fields.Many2one(
"fleet.vehicle.log.services.stage",
"Stage",
default=lambda self: self._default_stage(),
group_expand="_read_group_stage_ids",
tracking=True,
help="Current state of the vehicle",
ondelete="set null",
)

vendor_id = fields.Many2one(tracking=True)
purchaser_id = fields.Many2one(tracking=True)
user_id = fields.Many2one(
"res.users", "Responsible", tracking=True, default=lambda self: self.env.user
)
priority = fields.Selection(
[("0", "Normal"), ("1", "Important")], default="0", index=True
)
tag_ids = fields.Many2many(
"fleet.vehicle.log.services.tag",
"fleet_vehicle_log_services_tag_rel",
"service_id",
"tag_id",
string="Tags",
help="Classify and analyze your services categories like: Repair, Maintenance",
)
active = fields.Boolean(default=True, tracking=True)

@api.model
def _read_group_stage_ids(self, stages, domain, order):
return self.env["fleet.vehicle.log.services.stage"].search([], order=order)

def _track_subtype(self, init_values):
self.ensure_one()
if "purchaser_id" in init_values:
return self.env.ref(
"fleet_vehicle_service_kanban."
"mail_message_subtype_fleet_service_purchaser_updated"
)
if "vendor_id" in init_values:
return self.env.ref(
"fleet_vehicle_service_kanban."
"mail_message_subtype_fleet_service_vendor_updated"
)
if "user_id" in init_values:
return self.env.ref(
"fleet_vehicle_service_kanban."
"mail_message_subtype_fleet_service_user_updated"
)
return super(FleetVehicleLogServices, self)._track_subtype(init_values)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class FleetVehicleLogServicesStage(models.Model):
_name = "fleet.vehicle.log.services.stage"
_order = "sequence asc"
_description = "Vehicle Services Stages"

name = fields.Char(required=True, translate=True)
sequence = fields.Integer(help="Used to order the stages")
fold = fields.Boolean(
string="Folded in Kanban",
help="If True this stage is folded in the kanban view.",
)

_sql_constraints = [
(
"fleet_service_stage_name_unique",
"unique(name)",
"Stage name already exists",
)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020-Present Druidoo - Manuel Marquez <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class FleetVehicleLogServicesTag(models.Model):
_name = "fleet.vehicle.log.services.tag"
_description = "Services Tags"

name = fields.Char("Tag Name", required=True, translate=True)
color = fields.Integer("Color Index")

_sql_constraints = [
("name_uniq", "unique (name)", "Tag name already exists !"),
]
8 changes: 8 additions & 0 deletions fleet_vehicle_service_kanban/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* `Druidoo <https://www.druidoo.io>`_:

* Iván Todorovich <[email protected]>
* Manuel Marquez <[email protected]>

* `PnLUG - Gruppo Odoo <https://odoo.pnlug.it>`_:

* Stefano Consolaro <[email protected]> (backport 13.0→12.0)
8 changes: 8 additions & 0 deletions fleet_vehicle_service_kanban/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module adds the following features to vehicle services (fleet.vehicle.log.service):

- Kanban view.
- Features of mail (chatter) and acitivities, includes a new activity view.
- Configurable activity types. Menu under `Fleet / Configuration / Services Logs / Activity Types`.
- New fields: Responsible, Priority, Tags, Active, Stage.
- Configurable stages. Menu under `Fleet / Configuration / Services Logs / Vehicle Services Stages`.
- Configurable tags. Menu under `Fleet / Configuration / Services Logs / Vehicle Services Tags`.
5 changes: 5 additions & 0 deletions fleet_vehicle_service_kanban/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
fleet_vehicle_log_services_stage_access_right_user,fleet_vehicle_log_services_stage_access_right_user,model_fleet_vehicle_log_services_stage,fleet.fleet_group_user,1,0,0,0
fleet_vehicle_log_services_stage_access_right_manager,fleet_vehicle_log_services_stage_access_right_manager,model_fleet_vehicle_log_services_stage,fleet.fleet_group_manager,1,1,1,1
fleet_vehicle_log_services_tag_access_right_user,fleet_vehicle_log_services_tag_access_right_user,model_fleet_vehicle_log_services_tag,fleet.fleet_group_user,1,0,0,0
fleet_vehicle_log_services_tag_access_right_manager,fleet_vehicle_log_services_tag_access_right_manager,model_fleet_vehicle_log_services_tag,fleet.fleet_group_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading