odoo-addon-openupgrade-scripts 16.0.1.0.3.257__py3-none-any.whl → 16.0.1.0.3.259__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,69 @@
1
+ # SPDX-FileCopyrightText: 2024 Coop IT Easy SC
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ import os.path
6
+
7
+ from lxml import etree
8
+ from openupgradelib import openupgrade
9
+
10
+ from odoo.modules import get_manifest
11
+ from odoo.tools.misc import file_open
12
+
13
+
14
+ def is_xml_filename(filename):
15
+ return os.path.splitext(filename)[1].lower() == ".xml"
16
+
17
+
18
+ def get_module_xml_files(module_name):
19
+ return filter(is_xml_filename, get_manifest(module_name).get("data", []))
20
+
21
+
22
+ def find_record_data_path(model_name, module_name, xml_id):
23
+ """
24
+ Get the path of the XML data file containing the record.
25
+ """
26
+ for xml_file in get_module_xml_files(module_name):
27
+ filepath = "/".join((module_name, xml_file))
28
+ with file_open(filepath, "rb") as f:
29
+ root = etree.parse(f)
30
+ found = root.xpath(
31
+ '//record[@model="{model_name}"][@id="{xml_id}"]'.format(
32
+ model_name=model_name, xml_id=xml_id
33
+ )
34
+ )
35
+ if found:
36
+ return filepath
37
+ return None
38
+
39
+
40
+ def fill_all_null_mail_template_template_fs(env):
41
+ """
42
+ Fill the new template_fs field of all mail.template if it is null.
43
+
44
+ The mail.template template_fs field must contain the path of the data file
45
+ where it is defined (to allow for it to be reset to its default value).
46
+ Fill empty values by searching for the mail templates (by xml id) in the
47
+ XML files of the module that defines it.
48
+ """
49
+ env.cr.execute(
50
+ """
51
+ select mt.id, imd.module, imd.name
52
+ from mail_template as mt
53
+ inner join ir_model_data as imd on
54
+ imd.model = 'mail.template' and
55
+ imd.res_id = mt.id
56
+ where mt.template_fs is null
57
+ """
58
+ )
59
+ mail_template_model = env["mail.template"]
60
+ for mail_template_id, module_name, template_name in env.cr.fetchall():
61
+ template_fs = find_record_data_path("mail.template", module_name, template_name)
62
+ if template_fs is not None:
63
+ mail_template = mail_template_model.browse(mail_template_id)
64
+ mail_template.template_fs = template_fs
65
+
66
+
67
+ @openupgrade.migrate()
68
+ def migrate(env, version):
69
+ fill_all_null_mail_template_template_fs(env)
@@ -86,9 +86,11 @@ mail / mail.template / model_object_field (many2one) : DEL re
86
86
  mail / mail.template / null_value (char) : DEL
87
87
  mail / mail.template / sub_model_object_field (many2one): DEL relation: ir.model.fields
88
88
  mail / mail.template / sub_object (many2one) : DEL relation: ir.model
89
- mail / mail.template / template_fs (char) : NEW
90
89
  # NOTHING TO DO
91
90
 
91
+ mail / mail.template / template_fs (char) : NEW
92
+ # DONE (end-migration): fill the new field
93
+
92
94
 
93
95
  mail / res.partner / channel_ids (many2many) : table is now 'mail_channel_member' ('mail_channel_partner')
94
96
  # DONE in pre-migration script when renaming the model
@@ -1,9 +1,13 @@
1
+ import logging
2
+
1
3
  from openupgradelib import openupgrade
2
4
  from openupgradelib.openupgrade_160 import (
3
5
  _convert_field_bootstrap_4to5_sql,
4
6
  convert_field_bootstrap_4to5,
5
7
  )
6
8
 
9
+ logger = logging.getLogger(__name__)
10
+
7
11
 
8
12
  def convert_custom_qweb_templates_bootstrap_4to5(env):
9
13
  """Convert customized website views to Bootstrap 5."""
@@ -46,6 +50,7 @@ def convert_field_html_string_bootstrap_4to5(env):
46
50
  model = field.model_id.model
47
51
  if model in exclusions:
48
52
  continue
53
+ logger.info(f"Converting from BS4 to BS5 field {field} in model {model}")
49
54
  if env.get(model, False) is not False and env[model]._auto:
50
55
  if openupgrade.table_exists(env.cr, env[model]._table):
51
56
  if field.name in env[model]._fields and openupgrade.column_exists(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade-scripts
3
- Version: 16.0.1.0.3.257
3
+ Version: 16.0.1.0.3.259
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)
@@ -348,11 +348,12 @@ odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis.txt,sh
348
348
  odoo/addons/openupgrade_scripts/scripts/loyalty_delivery/16.0.1.0/upgrade_analysis.txt,sha256=8TnNXqdMPDyxBHuN4C6DaxijUWSLag4XVe15HbTg4BI,419
349
349
  odoo/addons/openupgrade_scripts/scripts/lunch/16.0.1.0/upgrade_analysis.txt,sha256=Vx_uxoW1IhIJF-UcG6q09VSnBCeY0VjBc1YE71RXgZs,593
350
350
  odoo/addons/openupgrade_scripts/scripts/lunch/16.0.1.0/upgrade_analysis_work.txt,sha256=4szGZDLH6jY7ZNGZq0aSB6ozmAMyMWv47yZYult2gTg,660
351
+ odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/end-migration.py,sha256=aX9Xy1GJatSTyUgalaUkJ8OjZILAqJ2SI6KPXJAXXvg,2223
351
352
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/noupdate_changes.xml,sha256=8b74tz5LRJrf76AuyOTRIl4w3NvwHe9YivwafOnoBdU,1439
352
353
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/post-migration.py,sha256=npwS2ylEgDiqM-CY-XzYe1o2tkXCCo3lR_qNhQPCzKM,262
353
354
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/pre-migration.py,sha256=8Ca4PL5QlpLEvvNhCnKFbm-CTN_lOfKou9puegiUZgg,4699
354
355
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis.txt,sha256=ev0yHLx23bmYinSh58rE9PJeF6PTwQHIThk9So-4uag,9744
355
- odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis_work.txt,sha256=-pirBHtVboB-crq4R1iHSvSj8CGZyNRRBOgeqwCq9EU,11251
356
+ odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis_work.txt,sha256=igoXVrhgdF0vOlWxPgZeI91uFhJsH5OvUxHHl6hMA7E,11295
356
357
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/tests/data.py,sha256=GU_Vcq1F4DWujCx3joNM4MvKAHSFt2b3vhwpbN7oYGo,332
357
358
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/tests/test_mail_migration.py,sha256=EK3JcDKwcaQwZshpxadL9MqKZfl6EfMop0V8L1iALTw,816
358
359
  odoo/addons/openupgrade_scripts/scripts/mail_bot/16.0.1.2/upgrade_analysis.txt,sha256=ejERvDwnBDajVnF6gvSuVxwZ_y6EfX2_oL7s0BM8u8M,147
@@ -605,7 +606,7 @@ odoo/addons/openupgrade_scripts/scripts/web_editor/16.0.1.0/upgrade_analysis.txt
605
606
  odoo/addons/openupgrade_scripts/scripts/web_editor/16.0.1.0/upgrade_analysis_work.txt,sha256=0aFLxiZZm2pddnvepo7jSIJ3Iek3mnH4oLV7rnG0jRE,213
606
607
  odoo/addons/openupgrade_scripts/scripts/web_tour/16.0.0.1/upgrade_analysis.txt,sha256=_dVyBxQ-ck0iyHgRd6mifxeSsMCRxdpCQcCDVn-lvMk,147
607
608
  odoo/addons/openupgrade_scripts/scripts/web_tour/16.0.0.1/upgrade_analysis_work.txt,sha256=OFVVLWaIounkcVq_mmX4DP7on6of6oG3NFVgMQ2KEZc,163
608
- odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py,sha256=3-OtTMbzmMoogxYi2gxG7AJMYwsJkg9huL4qw39mso0,2869
609
+ odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py,sha256=ZKQ7260nW_OZqCzXNYkLjIVzukKzCM8SC0ej_r4youc,3005
609
610
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/noupdate_changes.xml,sha256=L-3aiHxRTaP4bwEAnpCcb5PmP1DF4HXNTGb70cgsnb0,218
610
611
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py,sha256=o6fuzgKXOoamlXNMm9UYMGrWJ7xEnvyNzRNiK-h-ZWA,169
611
612
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py,sha256=Invtw62qgK3tIwp8vcjNueh9b5pnztTXfmuMsWiyoBU,4709
@@ -698,7 +699,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
698
699
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
699
700
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
700
701
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
701
- odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info/METADATA,sha256=oMJld-SmdFVOC67dusVFG5hpAGLUCdiAFvnI5BRlUfE,3810
702
- odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
703
- odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
704
- odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info/RECORD,,
702
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.259.dist-info/METADATA,sha256=3oBQdV209jHrWred6hGkAom2g58d7FWn4iZ1oVXy2AU,3810
703
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.259.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
704
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.259.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
705
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.259.dist-info/RECORD,,