-
Notifications
You must be signed in to change notification settings - Fork 239
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
[17.0][ADD] fieldservice_recurring_repair #1250
base: 17.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
============================== | ||
Field Service Recurring Repair | ||
============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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. |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Field Service Recurring Repair", | ||
"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"], | ||
"license": "AGPL-3", | ||
"development_status": "Beta", | ||
"maintainers": ["wolfhall", "max3903", "brian10048", "imlopes"], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from . import fsm_recurring |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||||||||||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||||||||||||||
# @author: Italo Lopes <[email protected]> | ||||||||||||||
# 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_by_equipment(self, vals): | ||||||||||||||
""" | ||||||||||||||
Create an order for each equipment. | ||||||||||||||
On fieldservice_repair, we create a repair order for each equipment. | ||||||||||||||
""" | ||||||||||||||
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 _should_create_by_equipment(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" | ||||||||||||||
) | ||||||||||||||
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 tip: This is exactly the same as:
Suggested change
|
||||||||||||||
|
||||||||||||||
def _create_order(self, date): | ||||||||||||||
# Originally this method return only a single fsm.order. | ||||||||||||||
# This method has been modified to return multiple fsm.order | ||||||||||||||
# as we are creating multiple orders based on equipments. | ||||||||||||||
self.ensure_one() | ||||||||||||||
if self._should_create_by_equipment(): | ||||||||||||||
vals = self._prepare_order_values(date) | ||||||||||||||
orders = self._split_create_by_equipment(vals) | ||||||||||||||
for order in orders: | ||||||||||||||
order._onchange_template_id() | ||||||||||||||
else: | ||||||||||||||
orders = super()._create_order(date) | ||||||||||||||
orders._onchange_template_id() | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Already done by super, isn't it? |
||||||||||||||
return orders |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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`` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Italo Lopes \<<[email protected]>\> |
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. | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
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`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @imlopes Can you use the latest logo from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking: to create all at once (better for perf)