Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,26 @@ def _pre_create_early_pay_discount_computation(env):
)


def _pre_account_move_line_invoice_date_computation(env):
"""Avoid triggering the computed method"""
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move_line
ADD COLUMN IF NOT EXISTS invoice_date DATE;
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move_line aml
SET invoice_date = am.invoice_date
FROM account_move am
WHERE am.invoice_date IS NOT NULL AND aml.move_id = am.id;
""",
)


def _decouple_obsolete_tables(env):
"""
Remove all foreign keys held by and pointed to template tables
Expand Down Expand Up @@ -280,6 +300,7 @@ def migrate(env, version):
_account_report_update_figure_type(env)
_account_tax_repartition_line_merge_repartition_lines_m2o(env)
_pre_create_early_pay_discount_computation(env)
_pre_account_move_line_invoice_date_computation(env)
_decouple_obsolete_tables(env)
_pre_create_account_report_active(env)
_remove_obsolete_constraints(env)
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ account / account.move.line / display_type (selection) : select
# NOTHING TO DO: new feature "Discount allocation" https://github.com/odoo/odoo/pull/133286

account / account.move.line / invoice_date (date) : NEW isrelated: related, stored
# NOTHING TO DO: ORM resolves by SQL this filling being a direct related field with 1 level depth.
# DONE: pre-migration: Pre-create the column for avoiding triggering the compute and transfer data from account moves to all the account move lines.

account / account.move.line / tax_audit (char) : DEL
# NOTHING TO DO: deprecated
Expand Down