odoo-addon-openupgrade-scripts 16.0.1.0.3.16__py3-none-any.whl → 16.0.1.0.3.18__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,8 @@
1
+ from openupgradelib import openupgrade
2
+
3
+
4
+ @openupgrade.migrate()
5
+ def migrate(env, version):
6
+ openupgrade.load_data(
7
+ env.cr, "barcodes_gs1_nomenclature", "16.0.1.0/noupdate_changes.xml"
8
+ )
@@ -0,0 +1,17 @@
1
+ from openupgradelib import openupgrade
2
+
3
+
4
+ def set_type(env):
5
+ openupgrade.logged_query(
6
+ env.cr,
7
+ """
8
+ UPDATE barcode_rule
9
+ SET type = 'pack_date'
10
+ WHERE type = 'packaging_date'
11
+ """,
12
+ )
13
+
14
+
15
+ @openupgrade.migrate()
16
+ def migrate(env, version):
17
+ set_type(env)
@@ -0,0 +1,17 @@
1
+ ---Models in module 'barcodes_gs1_nomenclature'---
2
+ ---Fields in module 'barcodes_gs1_nomenclature'---
3
+ barcodes_gs1_nomenclature / barcode.rule / type (False) : selection_keys is now '['alias', 'expiration_date', 'location', 'location_dest', 'lot', 'pack_date', 'package', 'package_type', 'product', 'quantity', 'use_date']' ('['alias', 'expiration_date', 'location', 'location_dest', 'lot', 'package', 'package_type', 'packaging_date', 'product', 'quantity', 'use_date']')
4
+
5
+ # DONE: update type value = packaging_date to pack_date
6
+
7
+ ---XML records in module 'barcodes_gs1_nomenclature'---
8
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_314y (noupdate)
9
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_320y (noupdate)
10
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_322y (noupdate)
11
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_323y (noupdate)
12
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_351y (noupdate)
13
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_360y (noupdate)
14
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_361y (noupdate)
15
+ NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_364y (noupdate)
16
+
17
+ # NOTHING TO DO
@@ -13,32 +13,7 @@ from odoo.addons.openupgrade_scripts.apriori import merged_modules, renamed_modu
13
13
  _logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
- @openupgrade.migrate(use_env=False)
17
- def migrate(cr, version):
18
- """
19
- Don't request an env for the base pre-migration as flushing the env in
20
- odoo/modules/registry.py will break on the 'base' module not yet having
21
- been instantiated.
22
- """
23
- if "openupgrade_framework" not in tools.config["server_wide_modules"]:
24
- _logger.error(
25
- "openupgrade_framework is not preloaded. You are highly "
26
- "recommended to run the Odoo with --load=openupgrade_framework "
27
- "when migrating your database."
28
- )
29
- openupgrade.update_module_names(cr, renamed_modules.items())
30
- openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True)
31
- # restricting inherited views to groups isn't allowed any more
32
- cr.execute(
33
- "DELETE FROM ir_ui_view_group_rel r "
34
- "USING ir_ui_view v "
35
- "WHERE r.view_id=v.id AND v.inherit_id IS NOT NULL AND v.mode != 'primary'"
36
- )
37
- # update all translatable fields
38
- cr.execute(
39
- "SELECT f.name, m.model FROM ir_model_fields f "
40
- "JOIN ir_model m ON f.model_id=m.id WHERE f.translate"
41
- )
16
+ def update_translatable_fields(cr):
42
17
  # map of nonstandard table names
43
18
  model2table = {
44
19
  "ir.actions.actions": "ir_actions",
@@ -59,6 +34,10 @@ def migrate(cr, version):
59
34
  "ir.actions.client": ["name"],
60
35
  "ir.actions.report": ["name"],
61
36
  }
37
+ cr.execute(
38
+ "SELECT f.name, m.model FROM ir_model_fields f "
39
+ "JOIN ir_model m ON f.model_id=m.id WHERE f.translate"
40
+ )
62
41
  for field, model in cr.fetchall():
63
42
  if field in exclusions.get(model, []):
64
43
  continue
@@ -83,20 +62,53 @@ def migrate(cr, version):
83
62
  cr,
84
63
  """
85
64
  WITH t AS (
86
- SELECT res_id, jsonb_object_agg(lang, value) AS value
87
- FROM ir_translation
88
- WHERE type = 'model' AND name = %(name)s AND state = 'translated'
89
- GROUP BY res_id
65
+ SELECT it.res_id as res_id, jsonb_object_agg(it.lang, it.value) AS value,
66
+ bool_or(imd.noupdate) AS noupdate
67
+ FROM ir_translation it
68
+ LEFT JOIN ir_model_data imd ON imd.model = %(model)s AND imd.res_id = it.res_id
69
+ WHERE it.type = 'model' AND it.name = %(name)s AND it.state = 'translated'
70
+ GROUP BY it.res_id
90
71
  )
91
72
  UPDATE "%(table)s" m
92
- SET "%(field_name)s" = t.value || m."%(field_name)s"
93
- FROM t
94
- WHERE t.res_id = m.id
73
+ SET "%(field_name)s" = CASE WHEN t.noupdate THEN m.%(field_name)s || t.value
74
+ ELSE t.value || m.%(field_name)s END
75
+ FROM t
76
+ WHERE t.res_id = m.id
95
77
  """,
96
- {"table": AsIs(table), "name": translation_name, "field_name": AsIs(field)},
78
+ {
79
+ "table": AsIs(table),
80
+ "model": model,
81
+ "name": translation_name,
82
+ "field_name": AsIs(field),
83
+ },
97
84
  )
98
85
  openupgrade.logged_query(
99
86
  cr,
100
87
  "DELETE FROM ir_translation WHERE type = 'model' AND name = %s",
101
88
  [translation_name],
102
89
  )
90
+
91
+
92
+ @openupgrade.migrate(use_env=False)
93
+ def migrate(cr, version):
94
+ """
95
+ Don't request an env for the base pre-migration as flushing the env in
96
+ odoo/modules/registry.py will break on the 'base' module not yet having
97
+ been instantiated.
98
+ """
99
+ if "openupgrade_framework" not in tools.config["server_wide_modules"]:
100
+ _logger.error(
101
+ "openupgrade_framework is not preloaded. You are highly "
102
+ "recommended to run the Odoo with --load=openupgrade_framework "
103
+ "when migrating your database."
104
+ )
105
+ openupgrade.update_module_names(cr, renamed_modules.items())
106
+ openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True)
107
+ # restricting inherited views to groups isn't allowed any more
108
+ cr.execute(
109
+ "DELETE FROM ir_ui_view_group_rel r "
110
+ "USING ir_ui_view v "
111
+ "WHERE r.view_id=v.id AND v.inherit_id IS NOT NULL AND v.mode != 'primary'"
112
+ )
113
+ # update all translatable fields
114
+ update_translatable_fields(cr)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade-scripts
3
- Version: 16.0.1.0.3.16
3
+ Version: 16.0.1.0.3.18
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)
@@ -32,10 +32,13 @@ odoo/addons/openupgrade_scripts/scripts/auth_totp_mail_enforce/16.0.1.0/noupdate
32
32
  odoo/addons/openupgrade_scripts/scripts/auth_totp_mail_enforce/16.0.1.0/upgrade_analysis.txt,sha256=FMeF8St_Piud_mwB9YE4jRpVTa--NsX0-TgUzamELME,189
33
33
  odoo/addons/openupgrade_scripts/scripts/barcodes/16.0.2.0/upgrade_analysis.txt,sha256=aVHHJpenY6xHfF_YxGygdm9MRLo165JzMd-zXtDl1nE,147
34
34
  odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/noupdate_changes.xml,sha256=Zme4cLIMu45gZGnYjTmgB-kboQRNcjsgJrd3V3PLwcc,2214
35
+ odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-migration.py,sha256=QscbXYz-bSLnmj8Nz-ntoeufMsVT9OQVHsyNrH3hVeE,201
36
+ odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py,sha256=UnOeMC4A0CEKvGJ1f26nT7JUfvQlpsqQyhkx11QUH74,304
35
37
  odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis.txt,sha256=DuKXBlZI9NlwFz438dKfblWEtK9o-ptLKv-WAFZQaPo,1174
38
+ odoo/addons/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt,sha256=6HrGPs9TjNpnn6LBsW_809mevfIc6Nrz2WDgUfZwj2s,1249
36
39
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/noupdate_changes.xml,sha256=8FLfPuTaMN-uLv_iEjdJM4XtbKi4yEV7afxM37goEuk,3781
37
40
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/post-migration.py,sha256=OU-gRxyx7crZ6IpuG-UuGgc2sVPudHE-vhGO6ZwCL8c,457
38
- odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py,sha256=9WyxFmDdYxCozTevvHvmH5r9KvSlW5xOVeUTp9ALYSs,4012
41
+ odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py,sha256=hXAgPGfM9FOn9-owLBjlaGHLHJQBoRuNQ8ew2rzY3uA,4449
39
42
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis.txt,sha256=c5Rqht4vwfgrbcxPKFeHGEsyzbDwDMLRrO9NySQPN1U,4937
40
43
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt,sha256=OrWO6JRFUjz3JfIg1wiJlyztoEtnPH13t3x1JkrgmL0,5118
41
44
  odoo/addons/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_general_log.txt,sha256=mqyVXdY3VQW6NzyRJwTdD5b5rRRrl0FM4rVst1vemR8,73020
@@ -473,7 +476,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
473
476
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
474
477
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
475
478
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=Y3zNAMnpWGzBNS-ogKwHB6Zvp4kZexMk1208AUrVgC8,12083
476
- odoo_addon_openupgrade_scripts-16.0.1.0.3.16.dist-info/METADATA,sha256=BSUJr8EMHmR-W8eyqih-Kd14yJAnH5eOiTjzU2ryuTs,3450
477
- odoo_addon_openupgrade_scripts-16.0.1.0.3.16.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
478
- odoo_addon_openupgrade_scripts-16.0.1.0.3.16.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
479
- odoo_addon_openupgrade_scripts-16.0.1.0.3.16.dist-info/RECORD,,
479
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.18.dist-info/METADATA,sha256=fsRlyC-aNhO5r1oi_yTlkwVG589bWCltHbiV105tQlo,3450
480
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.18.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
481
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.18.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
482
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.18.dist-info/RECORD,,