odoo-addon-openupgrade-scripts 16.0.1.0.3.304__py3-none-any.whl → 16.0.1.0.3.307__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.
@@ -137,6 +137,73 @@ def mail_channel_unset_wrong_group_public_id(env):
137
137
  )
138
138
 
139
139
 
140
+ def mail_channel_private_compatibility(env):
141
+ """In v15 you could set a private group that only members could access, now in v16
142
+ this is not possible.
143
+ Defining the group_public_id empty will make everyone can access, and leaving the
144
+ value that has group_public_id with 'base.group_user' by default is totally wrong.
145
+ In order to maintain the compatibility of the existing channels, two transformations
146
+ are necessary:
147
+ - If a channel is private, but had only one auto-subscription group (group_ids), those
148
+ group become the authorized one (group_public_id) of the channel, and it remains as such
149
+ as a channel, since at the end, the auto-subscription groups adds as members all the
150
+ users of those groups, acting in the same way.
151
+ - If the list of members was manual, then the channel becomes a 'Direct Messages'
152
+ (channel_type='group'), keeping the channel name and authorized members.
153
+ """
154
+ env.cr.execute(
155
+ """
156
+ SELECT
157
+ c.id,
158
+ c.name,
159
+ (
160
+ SELECT COUNT(res_groups_id)
161
+ FROM mail_channel_res_groups_rel
162
+ WHERE mail_channel_id = c.id
163
+ ) AS total_groups,
164
+ (
165
+ SELECT res_groups_id
166
+ FROM mail_channel_res_groups_rel
167
+ WHERE mail_channel_id = c.id
168
+ LIMIT 1
169
+ ) AS auto_subscribe_group_0
170
+ FROM mail_channel AS c
171
+ WHERE c.channel_type = 'channel' AND c.public = 'private'
172
+ """
173
+ )
174
+ for channel_id, _name, total_groups, auto_subscribe_group_0 in env.cr.fetchall():
175
+ if total_groups == 1:
176
+ openupgrade.logged_query(
177
+ env.cr,
178
+ """
179
+ UPDATE mail_channel
180
+ SET group_public_id = %s
181
+ WHERE id = %s
182
+ """,
183
+ (auto_subscribe_group_0, channel_id),
184
+ )
185
+ else:
186
+ # Remove the auto-subscription groups linked also to avoid
187
+ # _constraint_group_id_channel()
188
+ openupgrade.logged_query(
189
+ env.cr,
190
+ """
191
+ DELETE FROM mail_channel_res_groups_rel
192
+ WHERE mail_channel_id= %s
193
+ """,
194
+ (channel_id,),
195
+ )
196
+ openupgrade.logged_query(
197
+ env.cr,
198
+ """
199
+ UPDATE mail_channel
200
+ SET channel_type = 'group', group_public_id = NULL
201
+ WHERE id = %s
202
+ """,
203
+ (channel_id,),
204
+ )
205
+
206
+
140
207
  def scheduled_date_set_empty_strings_to_null(env):
141
208
  openupgrade.logged_query(
142
209
  env.cr,
@@ -161,3 +228,4 @@ def migrate(env, version):
161
228
  ir_act_server_rename_state_email(env)
162
229
  mail_channel_channel_type_required(env)
163
230
  scheduled_date_set_empty_strings_to_null(env)
231
+ mail_channel_private_compatibility(env)
@@ -4,6 +4,12 @@
4
4
  from openupgradelib import openupgrade
5
5
 
6
6
 
7
+ def _set_published_state(env):
8
+ """Set published state according to the provider state as that will keep the former
9
+ visibility state"""
10
+ env["payment.provider"].search([("state", "=", "enabled")]).is_published = True
11
+
12
+
7
13
  @openupgrade.migrate()
8
14
  def migrate(env, version):
9
15
  openupgrade.load_data(env.cr, "payment", "16.0.2.0/noupdate_changes.xml")
@@ -17,3 +23,4 @@ def migrate(env, version):
17
23
  "payment.payment_acquirer_test",
18
24
  ],
19
25
  )
26
+ _set_published_state(env)
@@ -65,7 +65,11 @@ payment / payment.provider / code (selection) : NEW re
65
65
  payment / payment.provider / allow_express_checkout (boolean): NEW
66
66
  payment / payment.provider / available_country_ids (many2many): NEW relation: res.country
67
67
  payment / payment.provider / express_checkout_form_view_id (many2one): NEW relation: ir.ui.view
68
+ # NOTHING TO DO: new features
69
+
68
70
  payment / payment.provider / is_published (boolean) : NEW
71
+ # DONE: Set it on enabled providers to keep the former behavior.
72
+
69
73
  payment / payment.provider / maximum_amount (float) : NEW
70
74
  payment / payment.provider / token_inline_form_view_id (many2one): NEW relation: ir.ui.view
71
75
  # NOTHING TO DO: new features
@@ -1,6 +1,28 @@
1
1
  from openupgradelib import openupgrade
2
2
 
3
3
 
4
+ def _handle_multi_location_visibility(env):
5
+ """There are certain views that are disabled/enabled according to the multi-location
6
+ security group, as it can be seen in this commit:
7
+
8
+ https://github.com/odoo/odoo/blob/8f6c56d0794c54bde0/addons/stock/models/
9
+ res_config_settings.py#L99-L126
10
+
11
+ so we need to mimic that behavior in case the group is enabled, as the views exists
12
+ by default with active=True.
13
+ """
14
+ multi_location_group_xml_id = "stock.group_stock_multi_locations"
15
+ if env.ref("base.group_user") in env.ref(multi_location_group_xml_id).implied_ids:
16
+ for xml_id in (
17
+ "stock.stock_location_view_tree2_editable",
18
+ "stock.stock_location_view_form_editable",
19
+ ):
20
+ view = (env.ref(xml_id, raise_if_not_found=False),)
21
+ if view:
22
+ view.active = False
23
+
24
+
4
25
  @openupgrade.migrate()
5
26
  def migrate(env, version):
27
+ _handle_multi_location_visibility(env)
6
28
  openupgrade.load_data(env.cr, "stock", "16.0.1.1/noupdate_changes.xml")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade_scripts
3
- Version: 16.0.1.0.3.304
3
+ Version: 16.0.1.0.3.307
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)
@@ -361,7 +361,7 @@ odoo/addons/openupgrade_scripts/scripts/lunch/16.0.1.0/upgrade_analysis_work.txt
361
361
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/end-migration.py,sha256=aX9Xy1GJatSTyUgalaUkJ8OjZILAqJ2SI6KPXJAXXvg,2223
362
362
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/noupdate_changes.xml,sha256=8b74tz5LRJrf76AuyOTRIl4w3NvwHe9YivwafOnoBdU,1439
363
363
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/post-migration.py,sha256=npwS2ylEgDiqM-CY-XzYe1o2tkXCCo3lR_qNhQPCzKM,262
364
- odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/pre-migration.py,sha256=8Ca4PL5QlpLEvvNhCnKFbm-CTN_lOfKou9puegiUZgg,4699
364
+ odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/pre-migration.py,sha256=7xPNXcG-JIjOSMGLx-OZ0HIlr7raBM2niPZx6RCQf6I,7322
365
365
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis.txt,sha256=ev0yHLx23bmYinSh58rE9PJeF6PTwQHIThk9So-4uag,9744
366
366
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/upgrade_analysis_work.txt,sha256=igoXVrhgdF0vOlWxPgZeI91uFhJsH5OvUxHHl6hMA7E,11295
367
367
  odoo/addons/openupgrade_scripts/scripts/mail/16.0.1.10/tests/data.py,sha256=GU_Vcq1F4DWujCx3joNM4MvKAHSFt2b3vhwpbN7oYGo,332
@@ -411,10 +411,10 @@ odoo/addons/openupgrade_scripts/scripts/note/16.0.1.0/upgrade_analysis_work.txt,
411
411
  odoo/addons/openupgrade_scripts/scripts/onboarding/16.0.1.0/upgrade_analysis.txt,sha256=cP8GUMuG61NgAHYNqvDwOYt8uSzNwxY8DZQCA5Y4X8g,4608
412
412
  odoo/addons/openupgrade_scripts/scripts/partner_autocomplete/16.0.1.1/upgrade_analysis.txt,sha256=TsD43ZvaQRR7jVtzaU-6QMNuCf5H3ZOLQ69ChSamxgQ,183
413
413
  odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/noupdate_changes.xml,sha256=qrUQ3Nv_w3-LrQqmOOTlJT_6VMFCd9w6q6-SvOd3hd8,1684
414
- odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/post-migration.py,sha256=ag6B5orYh0pQakuzVrRLQ_o_ec3TVan_W8qnLU23zSs,594
414
+ odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/post-migration.py,sha256=AE152F4NWmp6OQotdQ2fJPm2iFwR1KDMESsSX6xPooI,853
415
415
  odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/pre-migration.py,sha256=DEIy9E6jsGMogZc8QKDKZF1R_ViATOaV5J--iRiDseY,6247
416
416
  odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/upgrade_analysis.txt,sha256=wcwFpOQsSY_AXHTUfj6A3WU1PWLJc9wpvM2igjZQkpo,11035
417
- odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/upgrade_analysis_work.txt,sha256=GU5n8_EeAbNr58WJCBYkFSIHaNXHz_J0ZEAooynCXXc,14160
417
+ odoo/addons/openupgrade_scripts/scripts/payment/16.0.2.0/upgrade_analysis_work.txt,sha256=SLAwQHV4Hox8uh2VJaUEyN4pefVU0Q8yOQETmXUiDWM,14257
418
418
  odoo/addons/openupgrade_scripts/scripts/payment_adyen/16.0.2.0/noupdate_changes.xml,sha256=tZ_DXNQ9ldaMitcc1LXWokbrhH7B0d8DNupsva4pDe0,283
419
419
  odoo/addons/openupgrade_scripts/scripts/payment_adyen/16.0.2.0/upgrade_analysis.txt,sha256=PnM9HwyxVfLWa32Fl8HC2l9cN9JyEu-50aUxukBeszo,735
420
420
  odoo/addons/openupgrade_scripts/scripts/payment_alipay/16.0.2.0/upgrade_analysis.txt,sha256=SfiSv2_kzbFuUO1iPXhvdvvh2mwH1lHTaI-ZiF0CzFw,1446
@@ -596,7 +596,7 @@ odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_sale_timesheet/16.
596
596
  odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_stock_account/16.0.1.0/upgrade_analysis.txt,sha256=Vp-WUODorZEcKxq6rrNuRluCu9NbzZfNXIcNEM03Vdo,291
597
597
  odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_website_sale_slides/16.0.1.0/upgrade_analysis.txt,sha256=ia8_6HEpeaY5bOmyhrMq92t8PKztRaCPP_w7w4AqZW0,307
598
598
  odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/noupdate_changes.xml,sha256=duUlxKkToVmaan9wD3Kl8phi_TT3V4CJ3mNAADH69NE,805
599
- odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py,sha256=WsMBKr4yNZsR0eZ1jzcg7ebN-4nzI7hyxz1_cDWHbP0,167
599
+ odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py,sha256=l7KI1sRA0BODBpLLbYdVQOxxV_dMQDtlgCYlKRLV7K4,1068
600
600
  odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py,sha256=14OkA5HRLjc4u9ivuD2gK98O7SZ1tKTCL4bpjUb03fE,3662
601
601
  odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis.txt,sha256=hI1BB9O45hRFUGUM8_uws2yoblPYMy26X3bZt1II7_U,8133
602
602
  odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis_work.txt,sha256=NpSHHpukDOGGaegeyodMPh3rG3h-uPlTop8oTKQHjbY,14310
@@ -723,7 +723,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
723
723
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
724
724
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
725
725
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
726
- odoo_addon_openupgrade_scripts-16.0.1.0.3.304.dist-info/METADATA,sha256=YeCOIzsiNOljxObHuHZ5UJ_bokXortIKNUdfT1z6srw,3790
727
- odoo_addon_openupgrade_scripts-16.0.1.0.3.304.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
728
- odoo_addon_openupgrade_scripts-16.0.1.0.3.304.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
729
- odoo_addon_openupgrade_scripts-16.0.1.0.3.304.dist-info/RECORD,,
726
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.307.dist-info/METADATA,sha256=RHNmy7CLaEJfWmxG1MgHH2IVAujcNl7oPpcwRvoFAIc,3790
727
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.307.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
728
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.307.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
729
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.307.dist-info/RECORD,,