File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
openupgrade_framework/tests Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ from . import test_openupgrade_framework
Original file line number Diff line number Diff line change 1+ from odoo .tests .common import TransactionCase
2+ from odoo .tools .misc import mute_logger
3+
4+ from odoo .addons .base .models .ir_model import MODULE_UNINSTALL_FLAG
5+
6+
7+ class TestOpenupgradeFramework (TransactionCase ):
8+ def test_01_delete_undeletable_record (self ):
9+ """
10+ Test that Odoo doesn't crash when deleting records that can't be deleted
11+ during module upgrade
12+ """
13+ with (
14+ mute_logger ("odoo.sql_db" ),
15+ self .assertLogs (
16+ "odoo.addons.openupgrade_framework.odoo_patch.odoo.orm.models"
17+ ),
18+ ):
19+ self .env .ref ("base.partner_admin" ).with_context (
20+ ** {MODULE_UNINSTALL_FLAG : True }
21+ ).unlink ()
22+
23+ def test_02_invalid_view (self ):
24+ """
25+ Test that we patch away fatal view errors and log the problem
26+ """
27+ with self .assertLogs (
28+ "odoo.addons.openupgrade_framework.odoo_patch.odoo.addons.base.models.ir_ui_view"
29+ ):
30+ self .env ["ir.ui.view" ].create (
31+ {
32+ "model" : "res.partner" ,
33+ "arch" : '<form><field name="nonexisting_field" /></form>' ,
34+ }
35+ )
You can’t perform that action at this time.
0 commit comments