odoo-addon-openupgrade-scripts 16.0.1.0.3.263__py3-none-any.whl → 16.0.1.0.3.267__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.
@@ -158,7 +158,15 @@ def _account_bank_statement_line_fast_fill_internal_index(env):
158
158
  "char",
159
159
  False,
160
160
  "account",
161
- )
161
+ ),
162
+ (
163
+ "first_line_index",
164
+ "account.bank.statement",
165
+ "account_bank_statement",
166
+ "char",
167
+ False,
168
+ "account",
169
+ ),
162
170
  ],
163
171
  )
164
172
  openupgrade.logged_query(
@@ -174,6 +182,29 @@ def _account_bank_statement_line_fast_fill_internal_index(env):
174
182
  WHERE stmt.move_id = am.id;
175
183
  """,
176
184
  )
185
+ # Now let's prefill account_bank_statement first_line_index
186
+ openupgrade.logged_query(
187
+ env.cr,
188
+ """
189
+ WITH first_lines AS (
190
+ SELECT
191
+ statement_id,
192
+ MIN(internal_index) AS first_line_index
193
+ FROM
194
+ account_bank_statement_line
195
+ GROUP BY
196
+ statement_id
197
+ )
198
+ UPDATE
199
+ account_bank_statement AS abs
200
+ SET
201
+ first_line_index = fl.first_line_index
202
+ FROM
203
+ first_lines AS fl
204
+ WHERE
205
+ abs.id = fl.statement_id;
206
+ """,
207
+ )
177
208
 
178
209
 
179
210
  def _account_move_fast_fill_display_type(env):
@@ -408,6 +439,89 @@ def _fill_repartition_line_use_in_tax_closing(env):
408
439
  )
409
440
 
410
441
 
442
+ def _fill_account_bank_statement_is_complete(env):
443
+ """Speedup this column computation"""
444
+ # TODO: Consider instances with currencies which rounding is different to 2 digits
445
+ env.cr.execute(
446
+ "SELECT * FROM res_currency WHERE rounding != 0.01 AND active = true"
447
+ )
448
+ if env.cr.fetchone():
449
+ return
450
+ if not openupgrade.column_exists(env.cr, "account_bank_statement", "is_complete"):
451
+ openupgrade.add_fields(
452
+ env,
453
+ [
454
+ (
455
+ "is_complete",
456
+ "account.bank.statement",
457
+ "account_bank_statement",
458
+ "boolean",
459
+ False,
460
+ "account",
461
+ )
462
+ ],
463
+ )
464
+ openupgrade.logged_query(
465
+ env.cr,
466
+ """
467
+ WITH filtered_lines AS (
468
+ SELECT DISTINCT statement_id
469
+ FROM account_bank_statement_line absl
470
+ INNER JOIN account_move am ON am.id = absl.move_id
471
+ WHERE am.state = 'posted'
472
+ GROUP BY statement_id
473
+ )
474
+ UPDATE account_bank_statement acbs
475
+ SET is_complete = true
476
+ WHERE
477
+ acbs.id in (SELECT statement_id from filtered_lines)
478
+ AND
479
+ (
480
+ ROUND(acbs.balance_end, 2) =
481
+ ROUND(COALESCE(acbs.balance_end_real, 0), 2)
482
+ )
483
+ """,
484
+ )
485
+
486
+
487
+ def _precreate_account_move_auto_post_until(env):
488
+ """This new account.move field is ment to be filled manually. Its compute acts
489
+ merely as an onchange. We don't need to pre-fill it"""
490
+ if not openupgrade.column_exists(env.cr, "account_move", "auto_post_until"):
491
+ openupgrade.add_fields(
492
+ env,
493
+ [
494
+ (
495
+ "auto_post_until",
496
+ "account.move",
497
+ "account_move",
498
+ "date",
499
+ False,
500
+ "account",
501
+ )
502
+ ],
503
+ )
504
+
505
+
506
+ def _precreate_account_move_is_storno(env):
507
+ """There can't be storno moves as this is a new feature that needs to be set on the
508
+ company settings"""
509
+ if not openupgrade.column_exists(env.cr, "account_move", "is_storno"):
510
+ openupgrade.add_fields(
511
+ env,
512
+ [
513
+ (
514
+ "is_storno",
515
+ "account.move",
516
+ "account_move",
517
+ "boolean",
518
+ False,
519
+ "account",
520
+ )
521
+ ],
522
+ )
523
+
524
+
411
525
  @openupgrade.migrate()
412
526
  def migrate(env, version):
413
527
  openupgrade.rename_xmlids(env.cr, _xmlids_renames)
@@ -438,3 +552,6 @@ def migrate(env, version):
438
552
  _fast_fill_account_payment_amount_company_currency_signed(env)
439
553
  _account_journal_payment_sequence(env)
440
554
  _fill_repartition_line_use_in_tax_closing(env)
555
+ _precreate_account_move_auto_post_until(env)
556
+ _precreate_account_move_is_storno(env)
557
+ _fill_account_bank_statement_is_complete(env)
@@ -107,8 +107,9 @@ account / account.bank.statement / difference (float) : DEL
107
107
  # NOTHING TO DO
108
108
 
109
109
  account / account.bank.statement / first_line_index (char) : NEW isfunction: function, stored
110
+ # DONE pre-migration: Pre-compute for performance
110
111
  account / account.bank.statement / is_complete (boolean) : NEW isfunction: function, stored
111
- # NOTHING TO DO: Handled by ORM
112
+ # DONE pre-migration: Pre-compute for performance
112
113
 
113
114
  account / account.bank.statement / is_valid_balance_start (boolean): DEL
114
115
  account / account.bank.statement / journal_id (many2one) : now a function
@@ -179,8 +180,9 @@ account / account.move / auto_post (boolean) : type i
179
180
  # DONE pre-migration: Change column data type, recalculate the value if False set to 'no' else set 'at_date'
180
181
 
181
182
  account / account.move / auto_post_origin_id (many2one): NEW relation: account.move
182
- account / account.move / auto_post_until (date) : NEW hasdefault: compute
183
183
  # NOTHING TO DO
184
+ account / account.move / auto_post_until (date) : NEW hasdefault: compute
185
+ # DONE pre-migration: Pre-create column to avoid computing this new feature wich is meant to be set manually
184
186
 
185
187
  account / account.move / currency_id (many2one) : now a function
186
188
  # NOTHING TO DO
@@ -190,7 +192,7 @@ account / account.move / invoice_payments_widget (text): type i
190
192
  # NOTHING TO DO: compute no store field
191
193
 
192
194
  account / account.move / is_storno (boolean) : NEW hasdefault: compute
193
- # NOTHING TO DO
195
+ # DONE pre-migration: Pre-create column to avoid computing this new feature which has to be set at company level
194
196
 
195
197
  account / account.move / partner_shipping_id (many2one): previously in module sale
196
198
  # NOTHING TO DO
@@ -33,8 +33,11 @@ def convert_custom_qweb_templates_bootstrap_4to5(env):
33
33
  def convert_field_html_string_bootstrap_4to5(env):
34
34
  """Convert html field which might contain old bootstrap syntax"""
35
35
  # These models won't use bootstrap in their html fields
36
- exclusions = [
36
+ model_exclusions = [
37
+ "mail.activity",
37
38
  "mail.message",
39
+ "mail.wizard.invite",
40
+ "web_editor.converter.test",
38
41
  "mail.mail",
39
42
  "mail.template",
40
43
  "res.users",
@@ -43,22 +46,32 @@ def convert_field_html_string_bootstrap_4to5(env):
43
46
  "account.invoice.send",
44
47
  "mail.alias",
45
48
  ]
49
+ # We could want to refine a certain field logic to discard a good bunch of records
50
+ field_special_domain = {
51
+ "account.move": {
52
+ "narration": [
53
+ ("move_type", "in", ["out_invoice", "out_refund", "out_receipt"])
54
+ ]
55
+ },
56
+ }
46
57
  fields = env["ir.model.fields"].search(
47
- [("ttype", "=", "html"), ("store", "=", True)]
58
+ [
59
+ ("ttype", "=", "html"),
60
+ ("store", "=", True),
61
+ ("model", "not in", model_exclusions),
62
+ ]
48
63
  )
49
64
  for field in fields:
50
65
  model = field.model_id.model
51
- if model in exclusions:
52
- continue
53
- logger.info(f"Converting from BS4 to BS5 field {field} in model {model}")
66
+ # The method convert_field_bootstrap_4to5 takes care of empty fields considering
67
+ domain = field_special_domain.get(model, {}).get(field.name, [])
68
+ logger.info(f"Converting from BS4 to BS5 field {field.name} in model {model}")
54
69
  if env.get(model, False) is not False and env[model]._auto:
55
70
  if openupgrade.table_exists(env.cr, env[model]._table):
56
71
  if field.name in env[model]._fields and openupgrade.column_exists(
57
72
  env.cr, env[model]._table, field.name
58
73
  ):
59
- convert_field_bootstrap_4to5(
60
- env, model, field.name, domain=[(field.name, "!=", False)]
61
- )
74
+ convert_field_bootstrap_4to5(env, model, field.name, domain=domain)
62
75
 
63
76
 
64
77
  def rename_t_group_website_restricted_editor(env):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade-scripts
3
- Version: 16.0.1.0.3.263
3
+ Version: 16.0.1.0.3.267
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)
@@ -7,9 +7,9 @@ odoo/addons/openupgrade_scripts/readme/DESCRIPTION.rst,sha256=ckrM5YlY8awluPWIV7
7
7
  odoo/addons/openupgrade_scripts/readme/INSTALL.rst,sha256=tXbOmw3QIhO1KLIziMpXzuuY0tOhI8IGT2ktCArwfGM,115
8
8
  odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/noupdate_changes.xml,sha256=dQ5BuaiRxlN_swXTEwFBLUdIW87wJBaol5qeGcoiYgw,8353
9
9
  odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/post-migration.py,sha256=DLZ3i2cCDL3vL7bNw7Zsk1GdgHNGXPXEf5F94rxNYxM,2308
10
- odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py,sha256=fpT3rdG2YKwcjyHnQVZ9c9boRHxcDVHzCZ3FFId7NRQ,15654
10
+ odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py,sha256=j6lSahH395lLAp3PiC8UVs1opIiyyK96OyrBpMAhlO8,19206
11
11
  odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis.txt,sha256=LAGIn64-_mvvep8AfaPBS8qqo8O3dzw4wNA-5FgyQ0k,39201
12
- odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt,sha256=jvPUirUYB1bwdbNIMIHhDx7YrjrqkSxggDQ7RFxe4tc,41899
12
+ odoo/addons/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt,sha256=2-U7QLKxkUJd8B7r-hoBMqvuC4x5gSjWnU4LvM88QTs,42173
13
13
  odoo/addons/openupgrade_scripts/scripts/account_check_printing/16.0.1.0/upgrade_analysis.txt,sha256=LLJ88stlAeeCNgxAIiORZjQjbY-Sir138GI_FBpjIeE,189
14
14
  odoo/addons/openupgrade_scripts/scripts/account_debit_note/16.0.1.0/upgrade_analysis.txt,sha256=tJQzqc9HkZ1yHePn7nwW7VbCfBH_yfe5UEym2zLJ4AE,177
15
15
  odoo/addons/openupgrade_scripts/scripts/account_debit_note/16.0.1.0/upgrade_analysis_work.txt,sha256=JyMMl5xM8d4WV9DYdsw1ixUYYH8i5DGvpaukZvIPjeM,193
@@ -608,7 +608,7 @@ odoo/addons/openupgrade_scripts/scripts/web_editor/16.0.1.0/upgrade_analysis.txt
608
608
  odoo/addons/openupgrade_scripts/scripts/web_editor/16.0.1.0/upgrade_analysis_work.txt,sha256=0aFLxiZZm2pddnvepo7jSIJ3Iek3mnH4oLV7rnG0jRE,213
609
609
  odoo/addons/openupgrade_scripts/scripts/web_tour/16.0.0.1/upgrade_analysis.txt,sha256=_dVyBxQ-ck0iyHgRd6mifxeSsMCRxdpCQcCDVn-lvMk,147
610
610
  odoo/addons/openupgrade_scripts/scripts/web_tour/16.0.0.1/upgrade_analysis_work.txt,sha256=OFVVLWaIounkcVq_mmX4DP7on6of6oG3NFVgMQ2KEZc,163
611
- odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py,sha256=ZKQ7260nW_OZqCzXNYkLjIVzukKzCM8SC0ej_r4youc,3005
611
+ odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py,sha256=ZpSGVwmWzUfoTsagrZuRyPHL5HAdRcxVYkvu_TMTgxE,3518
612
612
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/noupdate_changes.xml,sha256=L-3aiHxRTaP4bwEAnpCcb5PmP1DF4HXNTGb70cgsnb0,218
613
613
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py,sha256=o6fuzgKXOoamlXNMm9UYMGrWJ7xEnvyNzRNiK-h-ZWA,169
614
614
  odoo/addons/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py,sha256=Invtw62qgK3tIwp8vcjNueh9b5pnztTXfmuMsWiyoBU,4709
@@ -701,7 +701,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
701
701
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
702
702
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
703
703
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
704
- odoo_addon_openupgrade_scripts-16.0.1.0.3.263.dist-info/METADATA,sha256=IhI5Y5020UcbghM5odv_vYeBPwl8klmDigRVPz9VRoQ,3810
705
- odoo_addon_openupgrade_scripts-16.0.1.0.3.263.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
706
- odoo_addon_openupgrade_scripts-16.0.1.0.3.263.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
707
- odoo_addon_openupgrade_scripts-16.0.1.0.3.263.dist-info/RECORD,,
704
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/METADATA,sha256=Q_D1dkf4Yn5suoH_vMDIe3BIs1YRaAJqFWrUy4j3yNQ,3810
705
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
706
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
707
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.267.dist-info/RECORD,,