Skip to content

Commit

Permalink
Merge pull request OCA#4310 from lefilament/16.0-fix-payment
Browse files Browse the repository at this point in the history
[16.0][OU-FIX] payment: install account_payment module
  • Loading branch information
pedrobaeza authored Feb 16, 2024
2 parents cbd729a + 2d234d6 commit 8b8216e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions openupgrade_scripts/scripts/payment/16.0.2.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,28 @@
]


def _module_account_payment_to_install(env):
"""
This function force installation of account_payment in case it is not yet installed
In v16, account_payment is auto_install = ["account"] (it was not in v15)
Since migration of payment module moves fields to account_payment, if the latter
is not installed you will get a JS error when trying to access account moves
"""
openupgrade.logged_query(
env.cr,
"""
UPDATE ir_module_module
SET state = 'to install'
WHERE name = 'account_payment' AND state = 'uninstalled'
""",
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_models(env.cr, _model_renames)
openupgrade.rename_tables(env.cr, _table_renames)
openupgrade.rename_fields(env, _field_renames)
openupgrade.copy_columns(env.cr, _columns_copies)
openupgrade.rename_xmlids(env.cr, _xmlid_renames)
_module_account_payment_to_install(env)

0 comments on commit 8b8216e

Please sign in to comment.