Skip to content

Commit

Permalink
[17.0][ADD]: fieldservice_recurring_repair
Browse files Browse the repository at this point in the history
  • Loading branch information
ilo committed Oct 23, 2024
1 parent 15a55b6 commit a6ac238
Show file tree
Hide file tree
Showing 14 changed files with 861 additions and 0 deletions.
134 changes: 134 additions & 0 deletions fieldservice_recurring_repair/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
===========================
Field Service Recurring Rep
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:63d6818ff0933504f5716e8f706153621e0878275471dcd36b0b1c4c1c570869
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/17.0/fieldservice_recurring_repair
: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-17-0/field-service-17-0-fieldservice_recurring_repair
: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/field-service&target_branch=17.0
:alt: Try me on Runboat

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

This module allows you to manage your recurring field service work
orders linked to repairs.

As repairs are often recurring and ``fieldservice_repair`` accept only
one equipment, this module allows you to create a recurring work order
for several equipments. This way, you can create a recurring order for a
group of equipments and the ``fsm.order`` will be created for each
equipment.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

- Follow the steps to configure ``fieldservice_repair`` module and
``fieldservice_recurring``

Usage
=====

To use this module, you can:

1. Create ``fsm.order.type`` Maintenance with internal type = Repair
2. Create ``fsm.template`` Maintenance with type Maintenance (created on
step 1)
3. Create a ``fsm.recurring.template`` Daily Maintenance with

- order template = maintenance (created on step 2)

4. Create a SO with a product with creation of new equipment activated
and the generation of recurring orders.
5. Confirm and deliver → you get a new ``fsm.equipment`` linked to the
delivered product and a ``fsm.recurring.order`` linked to the SO:
6. On the ``fsm.recurring.order``:

- set the equipment to the one delivered

7. click Start

This will create one ``fsm.order`` per equipment and one
``repair.order`` by ``fsm.order``.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_recurring_repair%0Aversion:%2017.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
-------

* Italo Lopes
* Camptocamp

Contributors
------------

- Italo Lopes <[email protected]>

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

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

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

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions fieldservice_recurring_repair/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from . import models
18 changes: 18 additions & 0 deletions fieldservice_recurring_repair/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2019 Brian McMaster, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Field Service Recurring Rep",
"summary": "Manage recurring Field Service orders for repairs",
"version": "17.0.1.1.0",
"category": "Field Service",
"author": "Italo Lopes, " "Camptocamp, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/field-service",
"depends": ["fieldservice_recurring", "fieldservice_repair"],
"data": [
# "views/fsm_recurring.xml",
],
"license": "AGPL-3",
"development_status": "Beta",
"maintainers": ["wolfhall", "max3903", "brian10048", "imlopes"],
}
5 changes: 5 additions & 0 deletions fieldservice_recurring_repair/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from . import fsm_recurring
36 changes: 36 additions & 0 deletions fieldservice_recurring_repair/models/fsm_recurring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class FSMRecurringOrder(models.Model):
_inherit = "fsm.recurring"

def _split_create(self, vals):
self.ensure_one()
orders = self.env["fsm.order"]
for equipment in self.equipment_ids:
order_vals = vals.copy()
order_vals["equipment_id"] = equipment.id
orders |= self.env["fsm.order"].create(order_vals)
return orders

def _check_split_create(self):
return bool(
self.fsm_order_template_id
and self.fsm_order_template_id.type_id
and self.fsm_order_template_id.type_id.internal_type == "repair"
)

def _create_order(self, date):
self.ensure_one()
vals = self._prepare_order_values(date)
if self._check_split_create():
orders = self._split_create(vals)
for order in orders:
order._onchange_template_id()
else:
orders = super()._create_order(date)
orders._onchange_template_id()
return orders
3 changes: 3 additions & 0 deletions fieldservice_recurring_repair/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions fieldservice_recurring_repair/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To configure this module, you need to:

- Follow the steps to configure ``fieldservice_repair`` module and ``fieldservice_recurring``
1 change: 1 addition & 0 deletions fieldservice_recurring_repair/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Italo Lopes \<<[email protected]>\>
8 changes: 8 additions & 0 deletions fieldservice_recurring_repair/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module allows you to manage your recurring field service work
orders linked to repairs.

As repairs are often recurring and `fieldservice_repair` accept only one
equipment, this module allows you to create a recurring work order for several
equipments. This way, you can create a recurring order for a group of equipments
and the `fsm.order` will be created for each equipment.

15 changes: 15 additions & 0 deletions fieldservice_recurring_repair/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
To use this module, you can:

1. Create `fsm.order.type` Maintenance with internal type = Repair
2. Create `fsm.template` Maintenance with type Maintenance (created on step 1)
3. Create a `fsm.recurring.template` Daily Maintenance with
- order template = maintenance (created on step 2)
4. Create a SO with a product with creation of new equipment activated
and the generation of recurring orders.
5. Confirm and deliver → you get a new `fsm.equipment` linked to the delivered product
and a `fsm.recurring.order` linked to the SO:
6. On the `fsm.recurring.order`:
- set the equipment to the one delivered
7. click Start

This will create one `fsm.order` per equipment and one `repair.order` by `fsm.order`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a6ac238

Please sign in to comment.