mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][MIG]agreement_repair: Migrated to v14
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
# Copyright (C) 2021 - TODAY, Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
# Copyright (C) 2021 - TODAY, Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
# Copyright (C) 2021 - TODAY, Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
# Copyright (C) 2021 - TODAY, Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class Agreement(models.Model):
|
class Agreement(models.Model):
|
||||||
@@ -9,7 +9,6 @@ class Agreement(models.Model):
|
|||||||
|
|
||||||
repair_count = fields.Integer("# Repair Orders", compute="_compute_repair_count")
|
repair_count = fields.Integer("# Repair Orders", compute="_compute_repair_count")
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_repair_count(self):
|
def _compute_repair_count(self):
|
||||||
for ag_rec in self:
|
for ag_rec in self:
|
||||||
ag_rec.repair_count = self.env["repair.order"].search_count(
|
ag_rec.repair_count = self.env["repair.order"].search_count(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
# Copyright (C) 2021 - TODAY, Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|||||||
3
agreement_repair/tests/__init__.py
Normal file
3
agreement_repair/tests/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
|
||||||
|
|
||||||
|
from . import test_agreement_repair
|
||||||
34
agreement_repair/tests/test_agreement_repair.py
Normal file
34
agreement_repair/tests/test_agreement_repair.py
Normal 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 TestAgreementRepair(common.TransactionCase):
|
||||||
|
def setUp(self):
|
||||||
|
super(TestAgreementRepair, 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)
|
||||||
|
|
||||||
|
repair_rec = self.env.ref('repair.repair_r0')
|
||||||
|
repair_rec.write({'agreement_id': agreement.id})
|
||||||
|
|
||||||
|
agreement._compute_repair_count()
|
||||||
|
self.assertEqual(agreement.repair_count, 1, "Wrong no of Repair Orders Count!")
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
<field name="name">Repair Orders</field>
|
<field name="name">Repair Orders</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">repair.order</field>
|
<field name="res_model">repair.order</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
||||||
<field name="context">{'create': False, 'edit': False}</field>
|
<field name="context">{'create': False, 'edit': False}</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user