File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
openupgrade_scripts/scripts/web_editor/18.0.1.0 Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -1078,7 +1078,7 @@ Module coverage 17.0 -> 18.0
10781078+---------------------------------------------------+----------------------+-------------------------------------------------+
10791079| web |Nothing to do | |
10801080+---------------------------------------------------+----------------------+-------------------------------------------------+
1081- | web_editor |Nothing to do | |
1081+ | web_editor |Done | |
10821082+---------------------------------------------------+----------------------+-------------------------------------------------+
10831083| web_hierarchy |Nothing to do | |
10841084+---------------------------------------------------+----------------------+-------------------------------------------------+
Original file line number Diff line number Diff line change 1+ import logging
2+
3+ from lxml import etree
4+ from openupgradelib import openupgrade
5+
6+ _logger = logging .getLogger (__name__ )
7+
8+
9+ @openupgrade .migrate ()
10+ def migrate (env , version ):
11+ views = env ["ir.ui.view" ].search (
12+ [("arch_db" , "like" , "expr=\" //div[@id='snippet_custom']\" " )]
13+ )
14+ for view in views :
15+ try :
16+ t_element = etree .fromstring (view .arch_db ).xpath ("//t" )[0 ]
17+ thumbnail_url = t_element .attrib ["t-thumbnail" ]
18+ full_snippet_key = t_element .attrib ["t-snippet" ]
19+ template_key , snippet_key = view .key .rsplit ("." , 1 )
20+ view .write (
21+ {
22+ "arch" : f"""
23+ <data inherit_id="{ template_key } ">
24+ <xpath expr="//snippets[@id='snippet_custom']" position="inside">
25+ <t t-snippet="{ full_snippet_key } " t-thumbnail="{ thumbnail_url } "/>
26+ </xpath>
27+ </data>
28+ """ # noqa: E501
29+ }
30+ )
31+ except Exception as e :
32+ _logger .error (f"View with id { view .id } cannot be transformed { e } " )
You can’t perform that action at this time.
0 commit comments