Skip to content

Commit

Permalink
Merge PR #3784 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by sergiocorato
  • Loading branch information
OCA-git-bot committed Dec 15, 2023
2 parents c8fab82 + 5536859 commit 37118d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions l10n_it_delivery_note/migrations/13.0.1.0.0/pre-migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ def migrate(env, version):
),
)
# update invoice_id ref in table
if openupgrade.column_exists(env.cr, "account_move", "old_invoice_id"):
clause = "am.old_invoice_id = inv.id"
else:
clause = "am.id = inv.move_id"
query = """
UPDATE {table}
SET
invoice_id = am.id
FROM account_invoice inv
JOIN account_move am ON am.id = inv.move_id
JOIN account_move am ON {clause}
WHERE
invoice_id = inv.id
""".format(
table=table
table=table,
clause=clause,
)
openupgrade.logged_query(
env.cr,
Expand Down

0 comments on commit 37118d5

Please sign in to comment.