[IMP] stock_production_lot_warranty: black, isort, prettier

This commit is contained in:
Sébastien Alix
2022-07-22 10:38:26 +02:00
parent 65be920b6c
commit 992fc157f4
3 changed files with 24 additions and 15 deletions

View File

@@ -0,0 +1 @@
../../../../stock_production_lot_warranty

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -1,24 +1,26 @@
# Copyright (C) 2021 Open Source Integrators
# Copyright (C) 2021 Serpent Consulting Services
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import common
from datetime import datetime, timedelta
from odoo.tests import common
class TestProductLotWarranty(common.TransactionCase):
def test_productlot_warranty(self):
company1 = self.env["res.company"].create({
"name": "Test company1"
})
product1 = self.env["product.product"].create({
"name": "TestProduct",
"warranty_type": "day",
"warranty": 5,
})
production_lot = self.env["stock.production.lot"].create({
"product_id": product1.id,
"company_id": company1.id
})
company1 = self.env["res.company"].create({"name": "Test company1"})
product1 = self.env["product.product"].create(
{
"name": "TestProduct",
"warranty_type": "day",
"warranty": 5,
}
)
production_lot = self.env["stock.production.lot"].create(
{"product_id": product1.id, "company_id": company1.id}
)
production_lot._onchange_product_id()
self.assertEqual(production_lot.warranty_exp_date,
(datetime.now() + timedelta(days=5)).date())
self.assertEqual(
production_lot.warranty_exp_date,
(datetime.now() + timedelta(days=5)).date(),
)