odoo-addon-openupgrade-scripts 16.0.1.0.3.257__py3-none-any.whl → 16.0.1.0.3.258__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.
- odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/end-migration.py +69 -0
- odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis_work.txt +3 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info}/METADATA +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info}/RECORD +6 -5
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info}/WHEEL +0 -0
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.257.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info}/top_level.txt +0 -0
@@ -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,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: odoo-addon-openupgrade-scripts
|
3
|
-
Version: 16.0.1.0.3.
|
3
|
+
Version: 16.0.1.0.3.258
|
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
|
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
|
@@ -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.
|
702
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
703
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
704
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
702
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info/METADATA,sha256=qmGcME25XXnA7boqyXy8twHJXM7cr9meDW_EZUlN0nE,3810
|
703
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
704
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
705
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.258.dist-info/RECORD,,
|
File without changes
|