Skip to content
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
94 changes: 94 additions & 0 deletions fieldservice_equipment_warranty/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

================================
Field Service Equipment Warranty
================================

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

.. |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/license-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/19.0/fieldservice_equipment_warranty
: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-19-0/field-service-19-0-fieldservice_equipment_warranty
: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=19.0
:alt: Try me on Runboat

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

Customizations related to ``fieldservice_equipment_stock`` module and
``product_warranty`` module.

This module allows managing warranties for equipment in the field
service module. It extends the functionality of the
``fieldservice_equipment_stock`` and ``product_warranty`` modules to
provide a link between equipment and product warranties.

**Table of contents**

.. contents::
:local:

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_equipment_warranty%0Aversion:%2019.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

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

- Italo LOPES <italo.lopes@camptocamp.com>

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

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

|maintainer-imlopes|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/19.0/fieldservice_equipment_warranty>`_ 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_equipment_warranty/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions fieldservice_equipment_warranty/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Field Service Equipment Warranty",
"summary": "Field Service equipment warranty",
"category": "Field Service",
"version": "19.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
# OCA/RMA
"product_warranty",
# OCA/field-service
"fieldservice_equipment_stock",
],
"website": "https://github.com/OCA/field-service",
"data": [
# Views
"views/fsm_equipment.xml",
],
"installable": True,
"maintainers": ["imlopes"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fieldservice_equipment_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \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: fieldservice_equipment_warranty
#: model:ir.model,name:fieldservice_equipment_warranty.model_fsm_equipment
msgid "Field Service Equipment"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
msgid "Product Warranty"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty
msgid "Warranty Duration"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_end_date
msgid "Warranty End Date"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
msgid "Warranty Period"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_start_date
msgid "Warranty Start Date"
msgstr ""

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty_type
msgid "Warranty Type"
msgstr ""

#. module: fieldservice_equipment_warranty
#. odoo-python
#: code:addons/fieldservice_equipment_warranty/models/fsm_equipment.py:0
msgid "Warranty end date must be after warranty start date."
msgstr ""
71 changes: 71 additions & 0 deletions fieldservice_equipment_warranty/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * behring_fieldservice_equipment_stock_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-22 13:47+0000\n"
"PO-Revision-Date: 2024-10-22 13:47+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: fieldservice_equipment_warranty
#: model:ir.model,name:fieldservice_equipment_warranty.model_fsm_equipment
msgid "Field Service Equipment"
msgstr "Équipement de service sur site"

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
msgid "Product Warranty"
msgstr "Garantie du produit"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty
msgid "Warranty Duration"
msgstr "Durée de garantie"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_end_date
msgid "Warranty End Date"
msgstr "Date de fin de garantie"

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
#, fuzzy
msgid "Warranty Period"
msgstr "Durée de garantie"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_start_date
msgid "Warranty Start Date"
msgstr "Date de début de garantie"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty_type
msgid "Warranty Type"
msgstr "Type de garantie"

#. module: fieldservice_equipment_warranty
#. odoo-python
#: code:addons/fieldservice_equipment_warranty/models/fsm_equipment.py:0
msgid "Warranty end date must be after warranty start date."
msgstr ""

#~ msgid "Day(s)"
#~ msgstr "Jour(s)"

#~ msgid "Month(s)"
#~ msgstr "Mois"

#~ msgid "Week(s)"
#~ msgstr "Semaine(s)"

#~ msgid "Year(s)"
#~ msgstr "Année(s)"
58 changes: 58 additions & 0 deletions fieldservice_equipment_warranty/i18n/it.po
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:
# * fieldservice_equipment_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-09-08 09:55+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: fieldservice_equipment_warranty
#: model:ir.model,name:fieldservice_equipment_warranty.model_fsm_equipment
msgid "Field Service Equipment"
msgstr "Attrezzatura assistenza sul campo"

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
msgid "Product Warranty"
msgstr "Garanzia prodotto"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty
msgid "Warranty Duration"
msgstr "Durata Garanzia"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_end_date
msgid "Warranty End Date"
msgstr "Data fine garanzia"

#. module: fieldservice_equipment_warranty
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_warranty.fsm_equipment_form_view_stock
msgid "Warranty Period"
msgstr "Periodo garanzia"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__warranty_start_date
msgid "Warranty Start Date"
msgstr "Data inizio garanzia"

#. module: fieldservice_equipment_warranty
#: model:ir.model.fields,field_description:fieldservice_equipment_warranty.field_fsm_equipment__product_warranty_type
msgid "Warranty Type"
msgstr "Tipo garanzia"

#. module: fieldservice_equipment_warranty
#. odoo-python
#: code:addons/fieldservice_equipment_warranty/models/fsm_equipment.py:0
msgid "Warranty end date must be after warranty start date."
msgstr "La data fine garanzia deve essere successiva alla data inizio garanzia."
1 change: 1 addition & 0 deletions fieldservice_equipment_warranty/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import fsm_equipment
63 changes: 63 additions & 0 deletions fieldservice_equipment_warranty/models/fsm_equipment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from dateutil.relativedelta import relativedelta

from odoo import api, fields, models
from odoo.exceptions import ValidationError


class FSMEquipment(models.Model):
_inherit = "fsm.equipment"

warranty_start_date = fields.Date(
copy=False, tracking=True, default=fields.Date.today
)
warranty_end_date = fields.Date(
tracking=True, compute="_compute_warranty_end_date", store=True, readonly=False
)
product_warranty = fields.Integer(
related="product_id.warranty", string="Warranty Duration"
)
product_warranty_type = fields.Selection(
related="product_id.warranty_type", string="Warranty Type"
)

@api.constrains("warranty_start_date", "warranty_end_date")
def _check_warranty_dates(self):
for equip in self:
if (
equip.warranty_start_date
and equip.warranty_end_date
and equip.warranty_end_date < equip.warranty_start_date
):
raise ValidationError(
self.env._("Warranty end date must be after warranty start date.")
)

def _get_warranty_end_date(self):
self.ensure_one()
warranty_end_date = fields.Date.today()
if self.product_id and self.product_id.warranty:
if self.product_id.warranty_type == "week":
warranty_end_date = self.warranty_start_date + relativedelta(
weeks=self.product_id.warranty
)
elif self.product_id.warranty_type == "month":
warranty_end_date = self.warranty_start_date + relativedelta(
months=self.product_id.warranty
)
elif self.product_id.warranty_type == "year":
warranty_end_date = self.warranty_start_date + relativedelta(
years=self.product_id.warranty
)
else:
warranty_end_date = self.warranty_start_date + relativedelta(
days=self.product_id.warranty
)
return warranty_end_date

@api.depends("product_id", "product_id.warranty", "warranty_start_date")
def _compute_warranty_end_date(self):
for equip in self:
equip.warranty_end_date = equip._get_warranty_end_date()
3 changes: 3 additions & 0 deletions fieldservice_equipment_warranty/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions fieldservice_equipment_warranty/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Italo LOPES \<<italo.lopes@camptocamp.com>\>
5 changes: 5 additions & 0 deletions fieldservice_equipment_warranty/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Customizations related to ``fieldservice_equipment_stock`` module and ``product_warranty`` module.

This module allows managing warranties for equipment in the field service module.
It extends the functionality of the `fieldservice_equipment_stock` and `product_warranty` modules
to provide a link between equipment and product warranties.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading