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

[17.0][ADD] fieldservice_agreement_repair #1272

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from
Open
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
86 changes: 86 additions & 0 deletions fieldservice_agreement_repair/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=============================
Fieldservice Agreement Repair
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3bc94f2421f97aba7e13a13c18f132028ca2eaf21f12a05e01b4d28269efde95
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_agreement_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_agreement_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 link ``repair.order`` with an ``agreement``
trough a ``fsm.equipment``. This way you can track the repair orders
that are covered by an agreement.

**Table of contents**

.. contents::
:local:

Usage
=====

No specific usage instructions.

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_agreement_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
-------

* Camptocamp SA
* Italo Lopes

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

- `Camptocamp <https://camptocamp.com>`__:

- 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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions fieldservice_agreement_repair/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions fieldservice_agreement_repair/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
# @author: Italo Lopes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Fieldservice Agreement Repair",
"summary": "Fieldservice Agreement Repair",
"category": "Field Service",
"version": "17.0.1.0.0",
"author": "Camptocamp SA, Italo Lopes, Odoo Community Association (OCA)",
"license": "AGPL-3",
"maintainer": "Camptocamp",
"depends": [
# OCA/agreement
"agreement_repair",
# OCA/field-service
"fieldservice_agreement",
"fieldservice_repair",
],
"website": "https://github.com/OCA/field-service",
"installable": True,
}
2 changes: 2 additions & 0 deletions fieldservice_agreement_repair/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import fsm_order
from . import repair_order
17 changes: 17 additions & 0 deletions fieldservice_agreement_repair/models/fsm_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
# @author: Italo Lopes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class FSMOrder(models.Model):
_inherit = "fsm.order"

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)

Check warning on line 13 in fieldservice_agreement_repair/models/fsm_order.py

View check run for this annotation

Codecov / codecov/patch

fieldservice_agreement_repair/models/fsm_order.py#L13

Added line #L13 was not covered by tests
for order in res:
if order.repair_id and order.agreement_id:
order.repair_id.agreement_id = order.agreement_id.id
return res

Check warning on line 17 in fieldservice_agreement_repair/models/fsm_order.py

View check run for this annotation

Codecov / codecov/patch

fieldservice_agreement_repair/models/fsm_order.py#L16-L17

Added lines #L16 - L17 were not covered by tests
26 changes: 26 additions & 0 deletions fieldservice_agreement_repair/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
# @author: Italo Lopes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class FSMEquipment(models.Model):
_inherit = "repair.order"

agreement_id = fields.Many2one(
"agreement", compute="_compute_agreement_id", store=True, readonly=False
)

@api.depends("product_id", "lot_id", "lot_id.product_id")
def _compute_agreement_id(self):
for repair in self:
if repair.product_id and repair.lot_id:
equipment_id = self.env["fsm.equipment"].search(
[
("product_id", "=", repair.product_id.id),
("lot_id", "=", repair.lot_id.id),
]
)
if equipment_id and equipment_id.agreement_id:
repair.agreement_id = equipment_id.agreement_id.id
3 changes: 3 additions & 0 deletions fieldservice_agreement_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_agreement_repair/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [Camptocamp](https://camptocamp.com):

> - Italo Lopes \<<[email protected]>\>
2 changes: 2 additions & 0 deletions fieldservice_agreement_repair/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows you to link ``repair.order`` with an ``agreement`` trough a ``fsm.equipment``.
This way you can track the repair orders that are covered by an agreement.
1 change: 1 addition & 0 deletions fieldservice_agreement_repair/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No specific usage instructions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fieldservice_agreement_repair/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading