From 11fe6addcfe2ffae2308c26af850927fe5fd3197 Mon Sep 17 00:00:00 2001 From: Khoa-Jocelyn Date: Thu, 22 Sep 2022 08:59:19 +0700 Subject: [PATCH] [FIX] account: Fix bug invoice data wrong when migrate 13.0 to 14.0 --- .../scripts/account/14.0.1.1/end-migration.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openupgrade_scripts/scripts/account/14.0.1.1/end-migration.py b/openupgrade_scripts/scripts/account/14.0.1.1/end-migration.py index 8285c7cba8b6..db3fc924708e 100644 --- a/openupgrade_scripts/scripts/account/14.0.1.1/end-migration.py +++ b/openupgrade_scripts/scripts/account/14.0.1.1/end-migration.py @@ -32,6 +32,14 @@ def _make_correct_account_type(env): ) +def _recompute_amount_residual(env): + account_move_lines_to_recompute = env['account.move.line'].search([ + ('parent_state', '=', 'posted'), + ('move_id.payment_state', 'in', ['not_paid', 'in_payment', 'partial'])]) + account_move_lines_to_recompute._compute_amount_residual() + + @openupgrade.migrate() def migrate(env, version): + _recompute_amount_residual(env) _make_correct_account_type(env)