odoo-addon-openupgrade-scripts 16.0.1.0.3.267__py3-none-any.whl → 16.0.1.0.3.270__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ # Copyright 2024 Tecnativa - David Vidal
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
+
4
+ from openupgradelib import openupgrade, openupgrade_160
5
+
6
+ from odoo.tools import column_exists
7
+
8
+
9
+ def update_callable_translatable_fields(env):
10
+ """Use Odoo's core method to get complete translations of translated fields with
11
+ a callable method for translations (html_translate, xml_translate)"""
12
+ exclusions = [
13
+ # ir.actions.* inherits the name and help columns from ir.actions.actions
14
+ ("ir.actions.act_window", "name"),
15
+ ("ir.actions.act_window", "help"),
16
+ ("ir.actions.act_url", "name"),
17
+ ("ir.actions.act_url", "help"),
18
+ ("ir.actions.server", "name"),
19
+ ("ir.actions.server", "help"),
20
+ ("ir.actions.client", "name"),
21
+ ("ir.actions.client", "help"),
22
+ ("ir.actions.report", "name"),
23
+ ("ir.actions.report", "help"),
24
+ ]
25
+ fields = env["ir.model.fields"].search_read(
26
+ [("translate", "=", True)], ["model", "name"]
27
+ )
28
+ fields_spec = [
29
+ (f["model"], f["name"])
30
+ for f in fields
31
+ if (
32
+ (f["model"], f["name"]) not in exclusions
33
+ and f["model"] in env
34
+ and column_exists(env.cr, env[f["model"]]._table, f["name"])
35
+ and f["name"] in env[f["model"]]._fields
36
+ and callable(env[f["model"]]._fields[f["name"]].translate)
37
+ )
38
+ ]
39
+ openupgrade_160.migrate_translations_to_jsonb(env, fields_spec)
40
+
41
+
42
+ @openupgrade.migrate()
43
+ def migrate(env, version):
44
+ update_callable_translatable_fields(env)
@@ -86,6 +86,7 @@ def update_translatable_fields(cr):
86
86
  continue
87
87
  # borrowed from odoo/tools/translate.py#_get_translation_upgrade_queries
88
88
  translation_name = "%s,%s" % (model, field)
89
+ emtpy_src = """'{"en_US": ""}'::jsonb"""
89
90
  openupgrade.logged_query(
90
91
  cr,
91
92
  f"""
@@ -98,8 +99,10 @@ def update_translatable_fields(cr):
98
99
  GROUP BY it.res_id
99
100
  )
100
101
  UPDATE {table} m
101
- SET "{field}" = CASE WHEN t.noupdate IS FALSE THEN t.value || m."{field}"
102
- ELSE m."{field}" || t.value END
102
+ SET "{field}" = CASE
103
+ WHEN m."{field}" IS NULL THEN {emtpy_src} || t.value
104
+ WHEN t.noupdate IS FALSE THEN t.value || m."{field}"
105
+ ELSE m."{field}" || t.value END
103
106
  FROM t
104
107
  WHERE t.res_id = m.id
105
108
  """,
@@ -108,11 +111,6 @@ def update_translatable_fields(cr):
108
111
  "name": translation_name,
109
112
  },
110
113
  )
111
- openupgrade.logged_query(
112
- cr,
113
- "DELETE FROM ir_translation WHERE type = 'model' AND name = %s",
114
- [translation_name],
115
- )
116
114
 
117
115
 
118
116
  @openupgrade.migrate(use_env=False)
@@ -0,0 +1,32 @@
1
+ from openupgradelib import openupgrade
2
+
3
+
4
+ def fetchmail_server_set_gmail_server_type(env):
5
+ if openupgrade.column_exists(
6
+ env.cr, "fetchmail_server", "use_google_gmail_service"
7
+ ):
8
+ openupgrade.logged_query(
9
+ env.cr,
10
+ """
11
+ UPDATE fetchmail_server
12
+ SET server_type='gmail'
13
+ WHERE use_google_gmail_service = true;
14
+ """,
15
+ )
16
+
17
+
18
+ def ir_mail_server_set_gmail_smtp_authentication(env):
19
+ openupgrade.logged_query(
20
+ env.cr,
21
+ """
22
+ UPDATE ir_mail_server
23
+ SET smtp_authentication='gmail'
24
+ WHERE use_google_gmail_service = true;
25
+ """,
26
+ )
27
+
28
+
29
+ @openupgrade.migrate()
30
+ def migrate(env, version):
31
+ fetchmail_server_set_gmail_server_type(env)
32
+ ir_mail_server_set_gmail_smtp_authentication(env)
@@ -0,0 +1,19 @@
1
+ ---Models in module 'google_gmail'---
2
+ ---Fields in module 'google_gmail'---
3
+ google_gmail / fetchmail.server / google_gmail_access_token (char): previously in module fetchmail_gmail
4
+ google_gmail / fetchmail.server / google_gmail_access_token_expiration (integer): previously in module fetchmail_gmail
5
+ google_gmail / fetchmail.server / google_gmail_authorization_code (char): previously in module fetchmail_gmail
6
+ google_gmail / fetchmail.server / google_gmail_refresh_token (char): previously in module fetchmail_gmail
7
+ google_gmail / fetchmail.server / google_gmail_uri (char) : previously in module fetchmail_gmail
8
+ # NOTHING TO DO: fetchmail_gmail has been merged into this
9
+
10
+ google_gmail / fetchmail.server / server_type (False) : NEW selection_keys: ['gmail', 'imap', 'local', 'pop'], mode: modify
11
+ # DONE pre-migration: fill value server_type is gmail if use_google_gmail_service is enable
12
+
13
+ google_gmail / ir.mail_server / smtp_authentication (False) : NEW selection_keys: ['certificate', 'gmail', 'login'], mode: modify
14
+ google_gmail / ir.mail_server / use_google_gmail_service (boolean): DEL
15
+ # DONE pre-migration: fill value smtp_authentication is gmail if use_google_gmail_service is enable
16
+
17
+ ---XML records in module 'google_gmail'---
18
+ NEW ir.ui.view: google_gmail.fetchmail_server_view_form
19
+ # NOTHING TO DO
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade-scripts
3
- Version: 16.0.1.0.3.267
3
+ Version: 16.0.1.0.3.270
4
4
  Summary: Module that contains all the migrations analysis and scripts for migrate Odoo SA modules.
5
5
  Home-page: https://github.com/OCA/OpenUpgrade
6
6
  Author: Odoo Community Association (OCA)
@@ -49,9 +49,10 @@ odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-
49
49
  odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py,sha256=UnOeMC4A0CEKvGJ1f26nT7JUfvQlpsqQyhkx11QUH74,304
50
50
  odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis.txt,sha256=DuKXBlZI9NlwFz438dKfblWEtK9o-ptLKv-WAFZQaPo,1174
51
51
  odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt,sha256=6HrGPs9TjNpnn6LBsW_809mevfIc6Nrz2WDgUfZwj2s,1249
52
+ odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/end-migration.py,sha256=y-9rMcssFgQHfiAXRLW6JF6NB2_8Bi0wY5teaZFLxME,1583
52
53
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/noupdate_changes.xml,sha256=3JSJstFCXpOAjzDMxmtKAxV2FQRUpTJaf1_BIPkylpI,4331
53
54
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/post-migration.py,sha256=OU-gRxyx7crZ6IpuG-UuGgc2sVPudHE-vhGO6ZwCL8c,457
54
- odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py,sha256=CfJmTcdYEOkDZG-g4ZHFjj-mH8daG6fS88hGs3o2hkQ,5676
55
+ odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py,sha256=XD51rvXdvyVc1T-t5sf4VnUZoU_qkYfasFu4hB-4DZU,5624
55
56
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis.txt,sha256=fl7Gv0YVX243NtcDX_o-d40AHSEG2Hap1lA0oHjKGHk,11206
56
57
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt,sha256=eyd3tF1ctvWY6b9cPULRC9-KPKyKXolXVnE6Re2-nKw,11387
57
58
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_general_log.txt,sha256=N3lzm8q5B00VVMwzL3CCX7HZIMx0bLi1Be9M186yCpc,17304
@@ -131,7 +132,9 @@ odoo/addons/openupgrade_scripts/scripts/google_account/16.0.1.0/upgrade_analysis
131
132
  odoo/addons/openupgrade_scripts/scripts/google_calendar/16.0.1.0/pre-migration.py,sha256=pr7pQBxDlCPX-NiS3yxc0jCNQPhG13QXmGgAbzjKc0A,368
132
133
  odoo/addons/openupgrade_scripts/scripts/google_calendar/16.0.1.0/upgrade_analysis.txt,sha256=vtlGaXwEI5VzGKgNJ3n1iOzlHnVm_tiFtxJdaSUtajc,773
133
134
  odoo/addons/openupgrade_scripts/scripts/google_calendar/16.0.1.0/upgrade_analysis_work.txt,sha256=nOmkTeFL8yX645S3W3AiZNIZjMR-n6nB8zFN2o5CanI,934
135
+ odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/pre-migration.py,sha256=BAiL69BN72fnfUaU-_1LeqnqMIspIdlQ367N4ESmmHk,819
134
136
  odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/upgrade_analysis.txt,sha256=T6iNOaVAnUJyuehQ1uwTr8C9cXKmZU_Mw3EQQ2hPu1c,685
137
+ odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/upgrade_analysis_work.txt,sha256=ZFiT39XdvjqP9MWdctq_OLT4yaKvi034a9tSmIarJsA,1395
135
138
  odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/noupdate_changes.xml,sha256=7Kh6ikV0c8llO66FzBlAXZuPURS0oJLO43aQSqKs9ow,950
136
139
  odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py,sha256=uZ5qQzNQBbWlN27aLGrXw4veYihiDgrGvVHNlRGMRBY,7362
137
140
  odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/pre-migration.py,sha256=b1fnQVhiZBROobyiQhCmJ2y3CtCmEL7QtuL1Sijk3YQ,1704
@@ -701,7 +704,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
701
704
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
702
705
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
703
706
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
704
- odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/METADATA,sha256=Q_D1dkf4Yn5suoH_vMDIe3BIs1YRaAJqFWrUy4j3yNQ,3810
705
- odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
706
- odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
707
- odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/RECORD,,
707
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.270.dist-info/METADATA,sha256=hWWm0kfBxl8jW5sxKXcTWdne62kElh77MNyv1uZGFko,3810
708
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.270.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
709
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.270.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
710
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.270.dist-info/RECORD,,