odoo-addon-openupgrade-scripts 18.0.1.0.0.422__py3-none-any.whl → 18.0.1.0.0.425__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.
@@ -153,11 +153,65 @@ def account_account_code_fields(env):
153
153
  )
154
154
 
155
155
 
156
+ def _handle_outstanding_accounts(env):
157
+ """On version 17, the outstanding accounts were handled with 2 fields on each
158
+ res.company.
159
+
160
+ Now, they are handled putting specific XML-IDs on them, so we should create that
161
+ identifiers on the previous referenced accounts.
162
+
163
+ Besides, now Odoo doesn't generate journal entries by default, unless there's an
164
+ outstanding account put on the payment method line on the journals, so let's keep
165
+ the previous behavior setting the same outstanding accounts on the lines that have
166
+ it empty.
167
+ """
168
+ IMD = env["ir.model.data"]
169
+ for column in [
170
+ "account_journal_payment_debit_account_id",
171
+ "account_journal_payment_credit_account_id",
172
+ ]:
173
+ env.cr.execute(
174
+ f"SELECT id, {column} FROM res_company WHERE {column} IS NOT NULL"
175
+ )
176
+ for company_id, account_id in env.cr.fetchall():
177
+ name = f"{company_id}_{column}"
178
+ if not IMD.search([("module", "=", "account"), ("name", "=", name)]):
179
+ IMD.create(
180
+ {
181
+ "module": "account",
182
+ "name": name,
183
+ "model": "account.account",
184
+ "res_id": account_id,
185
+ "noupdate": True,
186
+ }
187
+ )
188
+ # Fill the outstanding account on journals
189
+ payment_type = (
190
+ "inbound"
191
+ if column == "account_journal_payment_debit_account_id"
192
+ else "outbound"
193
+ )
194
+ openupgrade.logged_query(
195
+ env.cr,
196
+ f"""UPDATE account_payment_method_line apml
197
+ SET payment_account_id = {account_id}
198
+ FROM account_journal aj, account_payment_method apm
199
+ WHERE aj.id = apml.journal_id
200
+ AND apm.id = apml.payment_method_id
201
+ AND aj.type IN ('bank', 'cash')
202
+ AND apm.payment_type = '{payment_type}'
203
+ AND apml.payment_account_id IS NULL
204
+ AND aj.company_id = {company_id}
205
+ """,
206
+ )
207
+
208
+
156
209
  @openupgrade.migrate()
157
210
  def migrate(env, version):
158
211
  handle_lock_dates(env)
159
212
  link_payments_to_moves(env)
160
213
  account_account_code_fields(env)
214
+ _handle_outstanding_accounts(env)
161
215
  openupgrade.m2o_to_x2m(
162
216
  env.cr, env["account.account"], "account_account", "company_ids", "company_id"
163
217
  )
@@ -211,7 +211,7 @@ account / product.template / property_account_income_id (many2one):
211
211
 
212
212
  account / res.company / account_journal_payment_credit_account_id (many2one): DEL relation: account.account
213
213
  account / res.company / account_journal_payment_debit_account_id (many2one): DEL relation: account.account
214
- # NOTHING TO DO
214
+ # DONE: post-migration: Put corresponding XML-IDs to the pointed accounts
215
215
 
216
216
  account / res.company / account_price_include (selection): NEW required, selection_keys: ['tax_excluded', 'tax_included'], hasdefault: default
217
217
  account / res.company / autopost_bills (boolean) : NEW hasdefault: default
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade_scripts
3
- Version: 18.0.1.0.0.422
3
+ Version: 18.0.1.0.0.425
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: odoo==18.0.*
6
6
  Requires-Dist: openupgradelib
@@ -6,10 +6,10 @@ odoo/addons/openupgrade_scripts/readme/CONFIGURE.md,sha256=rnx8ADTYzVUB93PIG3Lib
6
6
  odoo/addons/openupgrade_scripts/readme/DESCRIPTION.md,sha256=6hwHccovmE9cfaV7PQPvKUvNJa-f_Uc1wgXyL_SrYck,86
7
7
  odoo/addons/openupgrade_scripts/readme/INSTALL.md,sha256=NDKVZRv0J8BTqcSTD7JwUXL_AY-cDJoegn5IUTbEOFk,113
8
8
  odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/noupdate_changes.xml,sha256=givzahE7VAv9gM1TkNDHs3qhNh3AZacox5q-hDuDjIU,4078
9
- odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py,sha256=hZRueZ0yktDoBfB1_o7rQjXkTmAB4DfyK9YkXC5G3hU,6547
9
+ odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py,sha256=y2KOPiLlVI2qaLnM6V4QnzWt-xPQr70DsiB90FrM-Z4,8747
10
10
  odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/pre-migration.py,sha256=8lgeeCdLEQtK2FfTqhJV8gKvlZEC5YWyTEKtuLPrbhw,8420
11
11
  odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/upgrade_analysis.txt,sha256=xpQwQxWn0ktacfLBgmRuRMjvSY9R4ClAQlfLJRs35Tg,21369
12
- odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/upgrade_analysis_work.txt,sha256=z-IqChSmDrYuRklaEolzi648dTC_J-dNE67q7Taf5hw,25294
12
+ odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/upgrade_analysis_work.txt,sha256=wxQD3CdbMhJ1Ch23FEh49rYmGT4sX9Q6rCAX0G90LT4,25352
13
13
  odoo/addons/openupgrade_scripts/scripts/account/tests/data.py,sha256=beOIEOzb6-hvlpjM9VVZrSj8pqZ6U7AcrS-w3vkTgsU,490
14
14
  odoo/addons/openupgrade_scripts/scripts/account/tests/test_migration.py,sha256=UsHOHhSkUkmcm4inSE8VgFIn79E-6i9FXt3v6jHW5HY,791
15
15
  odoo/addons/openupgrade_scripts/scripts/account_check_printing/18.0.1.0/upgrade_analysis.txt,sha256=IY2z67lgzVtwG7Zzj71ks2why2Hwuz-mRPy9xEqfBcY,675
@@ -797,7 +797,7 @@ odoo/addons/openupgrade_scripts/scripts/website_slides_survey/18.0.1.0/upgrade_a
797
797
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
798
798
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
799
799
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=Jc0qAThlH5WnoSq6vPamjC8WyMkdo_9zkhDuU1qW1VI,12722
800
- odoo_addon_openupgrade_scripts-18.0.1.0.0.422.dist-info/METADATA,sha256=QyNclGS0zDYbbMx3bLXc1Y9Y23ILiUpC9TK2p12-J78,3812
801
- odoo_addon_openupgrade_scripts-18.0.1.0.0.422.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
802
- odoo_addon_openupgrade_scripts-18.0.1.0.0.422.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
803
- odoo_addon_openupgrade_scripts-18.0.1.0.0.422.dist-info/RECORD,,
800
+ odoo_addon_openupgrade_scripts-18.0.1.0.0.425.dist-info/METADATA,sha256=Lm0WQ2ytl_4sdiQ6u2P03xf36W8-PmhITiCvNrO4znc,3812
801
+ odoo_addon_openupgrade_scripts-18.0.1.0.0.425.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
802
+ odoo_addon_openupgrade_scripts-18.0.1.0.0.425.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
803
+ odoo_addon_openupgrade_scripts-18.0.1.0.0.425.dist-info/RECORD,,