Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ account / account.move / reverse_entry_id (many2one) : DEL re
account / account.move / reversed_entry_id (many2one) : NEW relation: account.move
account / account.invoice / refund_invoice_id (many2one) : DEL relation: account.invoice
# DONE: pre-migration: lift FK constraint in reverse_entry_id
# DONE: post-migration: used refund_invoice_id to fill reverse_entry_id in case is empty (for invoices transformed to moves)
# DONE: post-migration: used refund_invoice_id to fill reversed_entry_id in case is empty (for invoices transformed to moves)
# DONE: post-migration: used reverse_entry_id to fill reversed_entry_id in case is empty

account / account.move / tax_type_domain (char) : DEL
Expand Down
6 changes: 3 additions & 3 deletions addons/account/migrations/13.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,15 @@ def migration_voucher_moves(env):


def fill_account_move_reversed_entry_id(env):
# copy refund_invoice_id to reverse_entry_id
# copy refund_invoice_id to reversed_entry_id (both are set on the refund)
openupgrade.logged_query(
env.cr, """
UPDATE account_move am
SET reverse_entry_id = am2.id
SET reversed_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"""
WHERE am.reversed_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(
Expand Down
Loading