mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[ADD] rma_account_product_warranty in v16
This commit is contained in:
30
rma_account_product_warranty/README.rst
Normal file
30
rma_account_product_warranty/README.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:alt: License AGPL-3
|
||||
|
||||
============================
|
||||
RMA Account Product Warranty
|
||||
============================
|
||||
|
||||
This module integrates RMA with product warranties
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/ForgeFlow/stock-rma/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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Aaron Henriquez <aaron.henriquez@forgeflow.com>
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by ForgeFlow
|
||||
1
rma_account_product_warranty/__init__.py
Normal file
1
rma_account_product_warranty/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
14
rma_account_product_warranty/__manifest__.py
Normal file
14
rma_account_product_warranty/__manifest__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright 2023 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
{
|
||||
"name": "RMA Product Warranty",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"category": "RMA",
|
||||
"summary": "Integrates RMA Account with Product Warranty",
|
||||
"author": "ForgeFlow",
|
||||
"website": "https://github.com/ForgeFlow/stock-rma",
|
||||
"depends": ["rma_account", "rma_product_warranty"],
|
||||
"installable": True,
|
||||
}
|
||||
1
rma_account_product_warranty/models/__init__.py
Normal file
1
rma_account_product_warranty/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import rma_order_line
|
||||
34
rma_account_product_warranty/models/rma_order_line.py
Normal file
34
rma_account_product_warranty/models/rma_order_line.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright 2023 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class RmaOrderLine(models.Model):
|
||||
|
||||
_inherit = "rma.order.line"
|
||||
|
||||
def _compute_warranty_end_date(self):
|
||||
res = super()._compute_warranty_end_date()
|
||||
for rec in self:
|
||||
warranty = rec.product_id.warranty
|
||||
if rec.account_move_line_id and warranty:
|
||||
if rec.product_id.warranty_type == "day":
|
||||
rec.warranty_end_date = (
|
||||
rec.account_move_line_id.date + relativedelta(days=warranty)
|
||||
)
|
||||
elif rec.product_id.warranty_type == "week":
|
||||
rec.warranty_end_date = (
|
||||
rec.account_move_line_id.date + relativedelta(weeks=warranty)
|
||||
)
|
||||
elif rec.product_id.warranty_type == "month":
|
||||
rec.warranty_end_date = (
|
||||
rec.account_move_line_id.date + relativedelta(months=warranty)
|
||||
)
|
||||
elif rec.product_id.warranty_type == "year":
|
||||
rec.warranty_end_date = (
|
||||
rec.account_move_line_id.date + relativedelta(years=warranty)
|
||||
)
|
||||
return res
|
||||
@@ -0,0 +1 @@
|
||||
../../../../rma_account_product_warranty
|
||||
6
setup/rma_account_product_warranty/setup.py
Normal file
6
setup/rma_account_product_warranty/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user