mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-24 13:12:01 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import test_equipment_contract
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright 2019 Creu Blanca
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestEquipmentContract(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner = self.env["res.partner"].create({"name": "Test partner"})
|
||||
self.equipment_id = self.env["maintenance.equipment"].create(
|
||||
{"name": "Equipment"}
|
||||
)
|
||||
self.contract = self.env["contract.contract"].create(
|
||||
{
|
||||
"name": "Contract",
|
||||
"partner_id": self.partner.id,
|
||||
"equipment_ids": [(4, self.equipment_id.id)],
|
||||
}
|
||||
)
|
||||
|
||||
def test_equipment_contract(self):
|
||||
self.assertEqual(self.equipment_id.contract_count, 1)
|
||||
action = self.equipment_id.action_view_contracts()
|
||||
self.assertEqual(action["res_id"], self.contract.id)
|
||||
|
||||
self.env["contract.contract"].create(
|
||||
{
|
||||
"name": "Contract 2",
|
||||
"partner_id": self.partner.id,
|
||||
"equipment_ids": [(4, self.equipment_id.id)],
|
||||
}
|
||||
)
|
||||
self.assertEqual(self.equipment_id.contract_count, 2)
|
||||
action = self.equipment_id.action_view_contracts()
|
||||
self.assertIn("domain", action.keys())
|
||||
Loading…
Add table
Add a link
Reference in a new issue