File tree 3 files changed +67
-0
lines changed
3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ from odoo .models import BaseModel
2
+ import logging
3
+ _logger = logging .getLogger (__name__ )
4
+
5
+
6
+ _original_check_company = BaseModel ._check_company
7
+
8
+
9
+ def _check_company (self , fnames = None ):
10
+ """ Patch chec_check_company to avoid any error when run scripts, we enable later """
11
+ try :
12
+ _original_check_company
13
+ except Exception as e :
14
+ _logger .warning ('incompatible companies. This is what we get:\n %s' , e )
15
+
16
+
17
+ BaseModel ._check_company = _check_company
18
+
19
+
20
+ def migrate (cr , version ):
21
+ pass
Original file line number Diff line number Diff line change
1
+ from odoo .addons .base .models .ir_ui_view import View
2
+ import logging
3
+ _logger = logging .getLogger (__name__ )
4
+
5
+
6
+ _original_check_xml = View ._check_xml
7
+
8
+
9
+ def _check_xml (self ):
10
+ """ Patch check_xml to avoid any error when loading views, we check them later """
11
+ try :
12
+ _original_check_xml
13
+ except Exception as e :
14
+ _logger .warning ('Invalid view definition. This is what we get:\n %s' , e )
15
+
16
+
17
+ View ._check_xml = _check_xml
18
+
19
+
20
+ def migrate (cr , version ):
21
+ pass
Original file line number Diff line number Diff line change
1
+ from odoo import api , models
2
+
3
+ from odoo .addons .base .models .ir_model import (
4
+ IrModelSelection ,
5
+ )
6
+
7
+
8
+ def _process_ondelete (self ):
9
+ """Don't break on missing models when deleting their selection fields"""
10
+ to_process = self .browse ([])
11
+ for selection in self :
12
+ try :
13
+ self .env [selection .field_id .model ] # pylint: disable=pointless-statement
14
+ to_process += selection
15
+ except KeyError :
16
+ continue
17
+ return IrModelSelection ._process_ondelete ._original_method (to_process )
18
+
19
+
20
+ _process_ondelete ._original_method = IrModelSelection ._process_ondelete
21
+ IrModelSelection ._process_ondelete = _process_ondelete
22
+
23
+
24
+ def migrate (cr , version ):
25
+ pass
You can’t perform that action at this time.
0 commit comments