Skip to content

Commit

Permalink
[IMP] account: preserve refund_invoice_id as reversed_entry_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Jul 30, 2024
1 parent aabdb35 commit 747ee55
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/account/migrations/13.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,17 @@ def migration_voucher_moves(env):


def fill_account_move_reversed_entry_id(env):
# copy refund_invoice_id to reverse_entry_id
openupgrade.logged_query(
env.cr, """
UPDATE account_move am
SET reverse_entry_id = am2.id
FROM account_invoice ai
JOIN account_invoice ai2 ON ai.refund_invoice_id = ai2.id
JOIN account_move am2 ON am2.old_invoice_id = ai2.id
WHERE am.reverse_entry_id IS NULL AND am.old_invoice_id = ai.id"""
)
# copy reverse_entry_id to reversed_entry_id (the relation is reversed in 13.0)
openupgrade.logged_query(
env.cr, """
UPDATE account_move am
Expand Down

0 comments on commit 747ee55

Please sign in to comment.