diff --git a/fieldservice_purchase/tests/__init__.py b/fieldservice_purchase/tests/__init__.py new file mode 100644 index 0000000000..8851092fed --- /dev/null +++ b/fieldservice_purchase/tests/__init__.py @@ -0,0 +1 @@ +from . import test_fieldservice_purchase diff --git a/fieldservice_purchase/tests/test_fieldservice_purchase.py b/fieldservice_purchase/tests/test_fieldservice_purchase.py new file mode 100644 index 0000000000..478c656980 --- /dev/null +++ b/fieldservice_purchase/tests/test_fieldservice_purchase.py @@ -0,0 +1,26 @@ +# Copyright 2021 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestFieldservicePurchase(SavepointCase): + @classmethod + def setUpClass(cls): + super(TestFieldservicePurchase, cls).setUpClass() + cls.Pricelist = cls.env["product.supplierinfo"] + Partner = cls.env["res.partner"] + FSMPerson = cls.env["fsm.person"] + cls.vendor = Partner.create({"name": "vendor test"}) + cls.worker = FSMPerson.create( + {"name": "worker test", "partner_id": cls.vendor.id} + ) + + def test_pricelist_count(self): + Pricelist = self.Pricelist + vendor = self.vendor + worker = self.worker + self.assertEqual(worker.pricelist_count, 0) + Pricelist.create({"name": vendor.id}) + worker.invalidate_cache() + self.assertEqual(worker.pricelist_count, 1)