diff --git a/recurring_contract/migrations/14.0.1.0.2/pre-migration.py b/recurring_contract/migrations/14.0.1.0.2/pre-migration.py index 83a6691e..19f28420 100644 --- a/recurring_contract/migrations/14.0.1.0.2/pre-migration.py +++ b/recurring_contract/migrations/14.0.1.0.2/pre-migration.py @@ -95,3 +95,14 @@ def migrate(env, version): WHERE m.old_invoice_id = rel.account_invoice_id; """, ) + # Restore contract_id value on move lines + openupgrade.logged_query( + env.cr, + """ + update account_move_line m + set contract_id=i.contract_id + from account_invoice_line i + where m.contract_id is null and old_invoice_line_id = i.id + and i.contract_id is not null; + """, + )