File tree 1 file changed +23
-7
lines changed
pattern_import_export/migrations/12.0.4.0.0
1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change 6
6
7
7
@openupgrade .migrate ()
8
8
def migrate (env , version ):
9
+ params = {}
10
+ for field , default_value in [
11
+ ("pattern_file" , "NULL" ),
12
+ ("pattern_file_name" , "NULL" ),
13
+ ("pattern_last_generation_date" , "NULL" ),
14
+ ("partial_commit" , "True" ),
15
+ ("flush_step" , "500" ),
16
+ ("export_format" , "NULL" ),
17
+ ]:
18
+ if openupgrade .column_exists (env .cr , "ir_exports" , field ):
19
+ params [field ] = '"{}"' .format (field )
20
+ else :
21
+ params [field ] = default_value
22
+
9
23
env .cr .execute (
10
24
"""
11
25
INSERT INTO pattern_config (
@@ -20,15 +34,17 @@ def migrate(env, version):
20
34
)
21
35
SELECT
22
36
use_description,
23
- pattern_file,
24
- pattern_file_name,
25
- pattern_last_generation_date,
26
- export_format,
27
- partial_commit,
28
- flush_step,
37
+ {p[ pattern_file]} ,
38
+ {p[ pattern_file_name]} ,
39
+ {p[ pattern_last_generation_date]} ,
40
+ {p[ export_format]} ,
41
+ {p[ partial_commit]} ,
42
+ {p[ flush_step]} ,
29
43
id
30
44
FROM ir_exports WHERE is_pattern IS TRUE
31
- """
45
+ """ .format (
46
+ p = params
47
+ )
32
48
)
33
49
34
50
env .cr .execute (
You can’t perform that action at this time.
0 commit comments