odoo-addon-openupgrade-scripts 16.0.1.0.3.188__py3-none-any.whl → 16.0.1.0.3.190__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,86 @@
1
+ # Copyright 2023 Coop IT Easy SC
2
+ # Copyright 2024 Tecnativa - Pedro M. Baeza
3
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
+
5
+ from openupgradelib import openupgrade
6
+
7
+
8
+ def convert_service_to_purchase_to_company_dependent(env):
9
+ """The product.template.service_to_purchase field became company-dependent.
10
+ this means that it is no longer stored in the product_template table,
11
+ but in the ir_property table.
12
+
13
+ for such cases, openupgrade.convert_to_company_dependent() should
14
+ normally be used, but that function does not seem to support converting
15
+ a field to company-dependent without changing its name at the same time.
16
+ moreover, it stores boolean values even when they are false (what odoo
17
+ does not), and it creates values for all companies, which does not make
18
+ sense when a record is linked to a particular company only.
19
+ """
20
+ service_to_purchase_field_id = (
21
+ env.ref("sale_purchase.field_product_template__service_to_purchase").id,
22
+ )
23
+ # this boolean property stores its value in the value_integer column, and
24
+ # it is only stored if it is true.
25
+ openupgrade.logged_query(
26
+ env.cr,
27
+ """
28
+ insert into ir_property (
29
+ company_id, fields_id, value_integer, name, res_id, type
30
+ )
31
+ select
32
+ company_id,
33
+ %(field_id)s,
34
+ 1,
35
+ 'service_to_purchase',
36
+ 'product.template,' || id,
37
+ 'boolean'
38
+ from product_template
39
+ where
40
+ company_id is not null and
41
+ service_to_purchase
42
+ order by id
43
+ """,
44
+ {"field_id": service_to_purchase_field_id},
45
+ )
46
+ # for product.template records that are not linked to a company, create an
47
+ # ir.property record for each company.
48
+ openupgrade.logged_query(
49
+ env.cr,
50
+ """
51
+ insert into ir_property (
52
+ company_id,
53
+ fields_id,
54
+ value_integer,
55
+ name,
56
+ res_id,
57
+ type
58
+ )
59
+ select
60
+ rc.id,
61
+ %(field_id)s,
62
+ 1,
63
+ 'service_to_purchase',
64
+ 'product.template,' || pt.id,
65
+ 'boolean'
66
+ from product_template as pt
67
+ inner join res_company as rc on
68
+ pt.company_id is null and
69
+ pt.service_to_purchase
70
+ order by pt.id, rc.id
71
+ """,
72
+ {"field_id": service_to_purchase_field_id},
73
+ )
74
+
75
+
76
+ @openupgrade.migrate()
77
+ def migrate(env, version):
78
+ convert_service_to_purchase_to_company_dependent(env)
79
+ constraint = env.ref(
80
+ "sale_purchase.constraint_product_template_service_to_purchase", False
81
+ )
82
+ if constraint:
83
+ constraint._module_data_uninstall()
84
+ openupgrade.delete_records_safely_by_xml_id(
85
+ env, ["sale_purchase.constraint_product_template_service_to_purchase"]
86
+ )
@@ -0,0 +1,11 @@
1
+ ---Models in module 'sale_purchase'---
2
+ ---Fields in module 'sale_purchase'---
3
+ sale_purchase / product.template / service_to_purchase (boolean) : not stored anymore
4
+ # DONE: post-migration, convert to company-dependent field
5
+
6
+ ---XML records in module 'sale_purchase'---
7
+ DEL ir.model.constraint: sale_purchase.constraint_product_template_service_to_purchase
8
+ # DONE: post-migration, delete constraint
9
+
10
+ NEW ir.ui.view: sale_purchase.sale_order_cancel_view_form
11
+ # 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.188
3
+ Version: 16.0.1.0.3.190
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)
@@ -511,7 +511,9 @@ odoo/addons/openupgrade_scripts/scripts/sale_product_matrix/16.0.1.0/upgrade_ana
511
511
  odoo/addons/openupgrade_scripts/scripts/sale_project/16.0.1.0/upgrade_analysis.txt,sha256=3_MabDi3INHUQI9b0qYLPEAgQ-FiMBVyz6cf3eoldlU,1618
512
512
  odoo/addons/openupgrade_scripts/scripts/sale_project/16.0.1.0/upgrade_analysis_work.txt,sha256=XzPdzthCMjGri6-BgxmrLPf1ctXo1i-k8VXdsc80xKg,1648
513
513
  odoo/addons/openupgrade_scripts/scripts/sale_project_stock/16.0.1.0/upgrade_analysis.txt,sha256=CvydNXFLRJ3UyF1j1fW0FMiIYjMGFaA-KI8t4nPXekM,221
514
+ odoo/addons/openupgrade_scripts/scripts/sale_purchase/16.0.1.0/post-migration.py,sha256=keJZcWXEuNAYLlyVTF4akma3PCeaGdYEdCOMiAB1fvw,2871
514
515
  odoo/addons/openupgrade_scripts/scripts/sale_purchase/16.0.1.0/upgrade_analysis.txt,sha256=KICfQiqiyfFj1kfW0VXF0zyk8wnik_0APGVT0JdU9lY,361
516
+ odoo/addons/openupgrade_scripts/scripts/sale_purchase/16.0.1.0/upgrade_analysis_work.txt,sha256=o5NgI4ehOaScv8O89NdL0RVYG5gxxO0ie245nlGpR2g,480
515
517
  odoo/addons/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/noupdate_changes.xml,sha256=rgaGcEPiWrUftrz6BetgECgDqG3M3Nygj3XmTBVMvbo,3497
516
518
  odoo/addons/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/upgrade_analysis.txt,sha256=06ej-ps7VMDzYrQl7Hdd6uR_V_uhY2mtKQniOHUwmtA,351
517
519
  odoo/addons/openupgrade_scripts/scripts/sale_stock/16.0.1.0/pre-migration.py,sha256=HokoL5uhqtcBIZFSGMGiH215GZGHnLqXs7q7ko5lKLc,1606
@@ -656,7 +658,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
656
658
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
657
659
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
658
660
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
659
- odoo_addon_openupgrade_scripts-16.0.1.0.3.188.dist-info/METADATA,sha256=AwPnCo4DvA8JvHJfKfdf7aSDGEDPjmHgcAisRfmb1qA,3810
660
- odoo_addon_openupgrade_scripts-16.0.1.0.3.188.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
661
- odoo_addon_openupgrade_scripts-16.0.1.0.3.188.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
662
- odoo_addon_openupgrade_scripts-16.0.1.0.3.188.dist-info/RECORD,,
661
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.190.dist-info/METADATA,sha256=ru6ZtP2m4WHPkrMdjZ6iBvEa-5i9OActR6un07J0z4k,3810
662
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.190.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
663
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.190.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
664
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.190.dist-info/RECORD,,