[12.0][IMP] - Improve unit tests

This commit is contained in:
sbejaoui
2019-09-30 14:16:51 +02:00
committed by Rad0van
parent b8fa244fc7
commit 1ea463dfa9
5 changed files with 29 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
{ {
'name': 'Recurring - Product Contract', 'name': 'Recurring - Product Contract',
'version': '12.0.1.0.0', 'version': '12.0.2.0.0',
'category': 'Contract Management', 'category': 'Contract Management',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': "LasLabs, " 'author': "LasLabs, "

View 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)

View File

@@ -107,7 +107,7 @@ class SaleOrder(models.Model):
def action_show_contracts(self): def action_show_contracts(self):
self.ensure_one() self.ensure_one()
action = self.env.ref( action = self.env.ref(
"contract.action_account_analytic_sale_overdue_all" "contract.contract_contract_customer_form_view"
).read()[0] ).read()[0]
contracts = ( contracts = (
self.env['contract.line'] self.env['contract.line']

View File

@@ -294,3 +294,11 @@ class TestSaleOrder(TransactionCase):
self.assertEqual( self.assertEqual(
self.contract_line.termination_notice_rule_type, 'weekly' 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'),
)

View File

@@ -5,7 +5,7 @@
--> -->
<odoo> <odoo>
<record id="account_analytic_account_recurring_form_form" <record id="contract_contract_customer_form_view"
model="ir.ui.view"> model="ir.ui.view">
<field name="model">contract.contract</field> <field name="model">contract.contract</field>
<field name="inherit_id" <field name="inherit_id"