Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
4
maintenance_product/tests/__init__.py
Normal file
4
maintenance_product/tests/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_maintenance_product
|
||||
23
maintenance_product/tests/common.py
Normal file
23
maintenance_product/tests/common.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestMaintenanceProductBase(common.TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.product_category = cls.env["product.category"].create(
|
||||
{"name": "test-product-category"}
|
||||
)
|
||||
cls.partner = cls.env["res.partner"].create({"name": "Mr Odoo"})
|
||||
cls.product = cls.env["product.product"].create(
|
||||
{
|
||||
"name": "test-product",
|
||||
"categ_id": cls.product_category.id,
|
||||
"standard_price": 10,
|
||||
"maintenance_ok": True,
|
||||
"seller_ids": [(0, 0, {"partner_id": cls.partner.id})],
|
||||
}
|
||||
)
|
||||
30
maintenance_product/tests/test_maintenance_product.py
Normal file
30
maintenance_product/tests/test_maintenance_product.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import Form
|
||||
|
||||
from .common import TestMaintenanceProductBase
|
||||
|
||||
|
||||
class TestMaintenanceProduct(TestMaintenanceProductBase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.category = cls.env["maintenance.equipment.category"].create(
|
||||
{"name": "test-maintenance-equipment-category"}
|
||||
)
|
||||
cls.equipment = cls.env["maintenance.equipment"].create(
|
||||
{"name": "test-maintenance-equipment"}
|
||||
)
|
||||
|
||||
def test_maintenance_equipment_category(self):
|
||||
category_form = Form(self.category)
|
||||
category_form.product_category_id = self.product_category
|
||||
self.assertEqual(category_form.name, "test-product-category")
|
||||
|
||||
def test_maintenance_equipment(self):
|
||||
equipment_form = Form(self.equipment)
|
||||
equipment_form.product_id = self.product
|
||||
self.assertEqual(equipment_form.name, "test-product")
|
||||
self.assertEqual(equipment_form.cost, 10)
|
||||
self.assertEqual(equipment_form.partner_id, self.partner)
|
||||
Reference in New Issue
Block a user