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
126 changes: 126 additions & 0 deletions stock_production_lot_warranty/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
===================================
Warranty Date on Lot/Serial Numbers
===================================

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

.. |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%2Frma-lightgray.png?logo=github
:target: https://github.com/OCA/rma/tree/18.0/stock_production_lot_warranty
:alt: OCA/rma
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rma-18-0/rma-18-0-stock_production_lot_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/rma&target_branch=18.0
:alt: Try me on Runboat

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

Odoo does not provide the warranty information on the serial number of a
product.

This module allows you to compute the warranty expiration date of a
serialized product based on the warranty duration.

**Table of contents**

.. contents::
:local:

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

To configure this module:

- Go to Inventory > Configuration > Settings
- Activate the traceability
- Go to Inventory > Products > Products
- Create or select a product and set the warranty
- Go to the Inventory tab in the Logistics section
- Set the warranty duration

Usage
=====

To use this module,

- Go to Inventory > Products > Lot/Serial Numbers
- Create a new serial number and select a product
- The Warranty Expiration Date is automatically computed based on today
+ the warranty duration from the select product
- You can overwrite the computed date with your own value.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/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/rma/issues/new?body=module:%20stock_production_lot_warranty%0Aversion:%2018.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
-------

* Open Source Integrators

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

- Steve Campbell <scampbell@opensourceintegrators.com>
- Maxime Chambreuil <mchambreuil@opensourceintegraors.com>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

Other credits
-------------

This module has been financially supported by:

- Pavlov Media
<`https://www.pavlovmedia.com\\> <https://www.pavlovmedia.com\>>`__
- Open Source Integrators
<`https://www.opensourceintegrators.com\\> <https://www.opensourceintegrators.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-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px
:target: https://github.com/osi-scampbell
:alt: osi-scampbell
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
:target: https://github.com/max3903
:alt: max3903

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

|maintainer-osi-scampbell| |maintainer-max3903|

This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/18.0/stock_production_lot_warranty>`_ project on GitHub.

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

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

{
"name": "Warranty Date on Lot/Serial Numbers",
"summary": "Add warranty date to stock production lot",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Stock",
"website": "https://github.com/OCA/rma",
"depends": ["product_warranty", "stock"],
"data": ["views/stock_production_lot.xml"],
"installable": True,
"development_status": "Beta",
"maintainers": ["osi-scampbell", "max3903"],
}
27 changes: 27 additions & 0 deletions stock_production_lot_warranty/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_production_lot_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-11 20:45+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
"Language-Team: none\n"
"Language: pt\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 4.3.2\n"

#. module: stock_production_lot_warranty
#: model:ir.model,name:stock_production_lot_warranty.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lote/Série"

#. module: stock_production_lot_warranty
#: model:ir.model.fields,field_description:stock_production_lot_warranty.field_stock_production_lot__warranty_exp_date
msgid "Warranty Expiration Date"
msgstr "Data de Expiração da Garantia"
27 changes: 27 additions & 0 deletions stock_production_lot_warranty/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_production_lot_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-07-22 18:19+0000\n"
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\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 3.10\n"

#. module: stock_production_lot_warranty
#: model:ir.model,name:stock_production_lot_warranty.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lote/Serial"

#. module: stock_production_lot_warranty
#: model:ir.model.fields,field_description:stock_production_lot_warranty.field_stock_production_lot__warranty_exp_date
msgid "Warranty Expiration Date"
msgstr "Data de Término da Garantia"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_production_lot_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: stock_production_lot_warranty
#: model:ir.model,name:stock_production_lot_warranty.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""

#. module: stock_production_lot_warranty
#: model:ir.model.fields,field_description:stock_production_lot_warranty.field_stock_production_lot__warranty_exp_date
msgid "Warranty Expiration Date"
msgstr ""
2 changes: 2 additions & 0 deletions stock_production_lot_warranty/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import stock_production_lot
31 changes: 31 additions & 0 deletions stock_production_lot_warranty/models/stock_production_lot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 Serpent Consulting Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from dateutil.relativedelta import relativedelta

from odoo import api, fields, models

DELTA_TYPES = ("day", "week", "month", "year")


class StockProductionLot(models.Model):
_inherit = "stock.lot"

warranty_exp_date = fields.Date(string="Warranty Expiration Date")

def _get_warranty_exp_date(self, start_date=None):
if not start_date:
start_date = fields.Date.context_today(self)
elif hasattr(start_date, "astimezone"):
# Datetime object, convert to date
start_date = fields.Date.context_today(self, timestamp=start_date)
delta_type = self.product_id.product_tmpl_id.warranty_type
duration = self.product_id.product_tmpl_id.warranty
if not duration or delta_type not in DELTA_TYPES:
return False
return start_date + relativedelta(**{f"{delta_type}s": duration})

@api.onchange("product_id")
def _onchange_product_id(self):
self.warranty_exp_date = self._get_warranty_exp_date()
3 changes: 3 additions & 0 deletions stock_production_lot_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"
8 changes: 8 additions & 0 deletions stock_production_lot_warranty/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To configure this module:

- Go to Inventory \> Configuration \> Settings
- Activate the traceability
- Go to Inventory \> Products \> Products
- Create or select a product and set the warranty
- Go to the Inventory tab in the Logistics section
- Set the warranty duration
3 changes: 3 additions & 0 deletions stock_production_lot_warranty/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Steve Campbell \<scampbell@opensourceintegrators.com\>
- Maxime Chambreuil \<mchambreuil@opensourceintegraors.com\>
- Serpent Consulting Services Pvt. Ltd. \<support@serpentcs.com\>
4 changes: 4 additions & 0 deletions stock_production_lot_warranty/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module has been financially supported by:

- Pavlov Media \<https://www.pavlovmedia.com\>
- Open Source Integrators \<https://www.opensourceintegrators.com\>
5 changes: 5 additions & 0 deletions stock_production_lot_warranty/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Odoo does not provide the warranty information on the serial number of a
product.

This module allows you to compute the warranty expiration date of a
serialized product based on the warranty duration.
7 changes: 7 additions & 0 deletions stock_production_lot_warranty/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module,

- Go to Inventory \> Products \> Lot/Serial Numbers
- Create a new serial number and select a product
- The Warranty Expiration Date is automatically computed based on
today + the warranty duration from the select product
- You can overwrite the computed date with your own value.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading