diff --git a/stock_production_lot_warranty/README.rst b/stock_production_lot_warranty/README.rst new file mode 100644 index 00000000..52bfba20 --- /dev/null +++ b/stock_production_lot_warranty/README.rst @@ -0,0 +1,120 @@ +=================================== +Warranty Date on Lot/Serial Numbers +=================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/12.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-12-0/rma-12-0-stock_production_lot_warranty + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/145/12.0 + :alt: Try me on Runbot + +|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 > Master Data > 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 > Master Data > 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 `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* Steve Campbell +* Maxime Chambreuil +* Serpent Consulting Services Pvt. Ltd. + +Other credits +~~~~~~~~~~~~~ + +This module has been financially supported by: + +* Pavlov Media +* Open Source Integrators + +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 `__: + +|maintainer-osi-scampbell| |maintainer-max3903| + +This module is part of the `OCA/rma `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_production_lot_warranty/__init__.py b/stock_production_lot_warranty/__init__.py new file mode 100644 index 00000000..69f7babd --- /dev/null +++ b/stock_production_lot_warranty/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_production_lot_warranty/__manifest__.py b/stock_production_lot_warranty/__manifest__.py new file mode 100644 index 00000000..f78add05 --- /dev/null +++ b/stock_production_lot_warranty/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# 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': '12.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', + ] +} diff --git a/stock_production_lot_warranty/models/__init__.py b/stock_production_lot_warranty/models/__init__.py new file mode 100644 index 00000000..3e187a92 --- /dev/null +++ b/stock_production_lot_warranty/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import ( + stock_production_lot +) diff --git a/stock_production_lot_warranty/models/stock_production_lot.py b/stock_production_lot_warranty/models/stock_production_lot.py new file mode 100644 index 00000000..ddb58d5d --- /dev/null +++ b/stock_production_lot_warranty/models/stock_production_lot.py @@ -0,0 +1,42 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from datetime import datetime, timedelta +from dateutil.relativedelta import relativedelta +from odoo import api, fields, models +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT + + +class StockProductionLot(models.Model): + _inherit = 'stock.production.lot' + + warranty_exp_date = fields.Date(string='Warranty Expiration Date') + + @api.onchange('product_id') + def _onchange_product_id(self): + self.warranty_exp_date = False + if self.product_id and \ + self.product_id.product_tmpl_id.warranty_type and \ + self.product_id.product_tmpl_id.warranty: + warranty_type = self.product_id.product_tmpl_id.warranty_type + if warranty_type == 'day': + time = (datetime.now() + + timedelta(days=self.product_id. + product_tmpl_id.warranty)).strftime( + DEFAULT_SERVER_DATE_FORMAT) + elif warranty_type == 'week': + time = (datetime.now() + + timedelta(weeks=self.product_id. + product_tmpl_id.warranty)).strftime( + DEFAULT_SERVER_DATE_FORMAT) + elif warranty_type == 'month': + time = (datetime.now() + + relativedelta(months=+self.product_id. + product_tmpl_id.warranty)).strftime( + DEFAULT_SERVER_DATE_FORMAT) + elif warranty_type == 'year': + time = (datetime.now() + + relativedelta(years=+self.product_id. + product_tmpl_id.warranty)).strftime( + DEFAULT_SERVER_DATE_FORMAT) + self.warranty_exp_date = time diff --git a/stock_production_lot_warranty/readme/CONFIGURE.rst b/stock_production_lot_warranty/readme/CONFIGURE.rst new file mode 100644 index 00000000..39a9d0fe --- /dev/null +++ b/stock_production_lot_warranty/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +To configure this module: + +* Go to Inventory > Configuration > Settings +* Activate the traceability +* Go to Inventory > Master Data > Products +* Create or select a product and set the warranty +* Go to the Inventory tab in the Logistics section +* Set the warranty duration diff --git a/stock_production_lot_warranty/readme/CONTRIBUTORS.rst b/stock_production_lot_warranty/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..d2767f98 --- /dev/null +++ b/stock_production_lot_warranty/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Steve Campbell +* Maxime Chambreuil +* Serpent Consulting Services Pvt. Ltd. diff --git a/stock_production_lot_warranty/readme/CREDITS.rst b/stock_production_lot_warranty/readme/CREDITS.rst new file mode 100644 index 00000000..54d7b7a0 --- /dev/null +++ b/stock_production_lot_warranty/readme/CREDITS.rst @@ -0,0 +1,4 @@ +This module has been financially supported by: + +* Pavlov Media +* Open Source Integrators diff --git a/stock_production_lot_warranty/readme/DESCRIPTION.rst b/stock_production_lot_warranty/readme/DESCRIPTION.rst new file mode 100644 index 00000000..c3ceb9ed --- /dev/null +++ b/stock_production_lot_warranty/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +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. diff --git a/stock_production_lot_warranty/readme/USAGE.rst b/stock_production_lot_warranty/readme/USAGE.rst new file mode 100644 index 00000000..3bcbead5 --- /dev/null +++ b/stock_production_lot_warranty/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, + +* Go to Inventory > Master Data > 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. diff --git a/stock_production_lot_warranty/static/description/icon.png b/stock_production_lot_warranty/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/stock_production_lot_warranty/static/description/icon.png differ diff --git a/stock_production_lot_warranty/static/description/index.html b/stock_production_lot_warranty/static/description/index.html new file mode 100644 index 00000000..629b5ef5 --- /dev/null +++ b/stock_production_lot_warranty/static/description/index.html @@ -0,0 +1,459 @@ + + + + + + +Warranty Date on Lot/Serial Numbers + + + +
+

Warranty Date on Lot/Serial Numbers

+ + +

Beta License: AGPL-3 OCA/rma Translate me on Weblate Try me on Runbot

+

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

+ +
+

Configuration

+

To configure this module:

+
    +
  • Go to Inventory > Configuration > Settings
  • +
  • Activate the traceability
  • +
  • Go to Inventory > Master Data > 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 > Master Data > 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. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

This module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainers:

+

osi-scampbell max3903

+

This module is part of the OCA/rma project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_production_lot_warranty/views/stock_production_lot.xml b/stock_production_lot_warranty/views/stock_production_lot.xml new file mode 100644 index 00000000..f8e4939b --- /dev/null +++ b/stock_production_lot_warranty/views/stock_production_lot.xml @@ -0,0 +1,17 @@ + + + + + stock.production.lot + + + + + + + + + + +