[14.0][MIG]agreement_maintenance: migrated to v14

This commit is contained in:
Vimal Patel
2021-07-23 16:21:00 +05:30
committed by Olga Marco
parent 2c5c00dd61
commit cdde775653
15 changed files with 83 additions and 25 deletions

View File

@@ -0,0 +1,3 @@
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
from . import test_agreement_maintenance

View File

@@ -0,0 +1,34 @@
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import odoo.tests.common as common
from odoo import fields
class TestAgreementMaintenance(common.TransactionCase):
def setUp(self):
super(TestAgreementMaintenance, self).setUp()
self.agreement_obj = self.env["agreement"]
self.agreement_type_id = self.env["agreement.type"].create(
{"name": "Test Agreement Type", "active": True}
)
self.product = self.env.ref("product.product_product_8_product_template")
def test_fieldservice_purchase(self):
agreement_vals = {
"name": "Test Agreement",
"agreement_type_id": self.agreement_type_id.id,
"description": "Test Agreement",
"start_date": fields.Date.today(),
"end_date": fields.Date.today(),
}
agreement = self.agreement_obj.create(agreement_vals)
maintenance_req = self.env.ref("maintenance.m_request_7")
maintenance_req.write({"agreement_id": agreement.id})
agreement._compute_mr_count()
self.assertEqual(
agreement.mr_count, 1, "Wrong no of Maintenance Request Count!"
)