mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[12.0][IMP] - Improve unit tests
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
'name': 'Recurring - Product Contract',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '12.0.2.0.0',
|
||||
'category': 'Contract Management',
|
||||
'license': 'AGPL-3',
|
||||
'author': "LasLabs, "
|
||||
|
||||
18
product_contract/migrations/12.0.2.0.0/pre-migration.py
Normal file
18
product_contract/migrations/12.0.2.0.0/pre-migration.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright 2019 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
xmlids_to_rename = [
|
||||
(
|
||||
'product_contract.account_analytic_account_recurring_form_form',
|
||||
'product_contract.contract_contract_customer_form_view',
|
||||
)
|
||||
]
|
||||
openupgrade.rename_xmlids(cr, xmlids_to_rename)
|
||||
@@ -107,7 +107,7 @@ class SaleOrder(models.Model):
|
||||
def action_show_contracts(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref(
|
||||
"contract.action_account_analytic_sale_overdue_all"
|
||||
"contract.contract_contract_customer_form_view"
|
||||
).read()[0]
|
||||
contracts = (
|
||||
self.env['contract.line']
|
||||
|
||||
@@ -294,3 +294,11 @@ class TestSaleOrder(TransactionCase):
|
||||
self.assertEqual(
|
||||
self.contract_line.termination_notice_rule_type, 'weekly'
|
||||
)
|
||||
|
||||
def test_action_show_contracts(self):
|
||||
self.sale.action_confirm()
|
||||
action = self.sale.action_show_contracts()
|
||||
self.assertEqual(
|
||||
self.env['contract.contract'].search(action['domain']),
|
||||
self.sale.order_line.mapped('contract_id'),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="account_analytic_account_recurring_form_form"
|
||||
<record id="contract_contract_customer_form_view"
|
||||
model="ir.ui.view">
|
||||
<field name="model">contract.contract</field>
|
||||
<field name="inherit_id"
|
||||
|
||||
Reference in New Issue
Block a user