Skip to content

Commit

Permalink
[FIX] account: fill amount residual currency on account move line
Browse files Browse the repository at this point in the history
  • Loading branch information
royle-vietnam committed Apr 4, 2022
1 parent 024fd28 commit c9e1dc8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions openupgrade_scripts/scripts/account/14.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,19 @@ def fill_account_move_line_amounts(env):
)


def fill_account_move_line_amount_residual_currency(env):
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move_line aml
SET amount_residual_currency = aml.amount_residual
WHERE aml.company_currency_id = aml.currency_id
AND aml.amount_residual != 0
AND (aml.amount_residual_currency = 0
OR aml.amount_residual_currency IS NULL);""",
)


def fill_account_move_line_date(env):
openupgrade.logged_query(
env.cr,
Expand Down Expand Up @@ -859,6 +872,7 @@ def migrate(env, version):
pass_payment_to_journal_entry_narration(env)
fill_company_account_cash_basis_base_account_id(env)
fill_account_move_line_amounts(env)
fill_account_move_line_amount_residual_currency(env)
fill_account_move_line_date(env)
openupgrade.load_data(env.cr, "account", "14.0.1.1/noupdate_changes.xml")
try_delete_noupdate_records(env)
Expand Down

0 comments on commit c9e1dc8

Please sign in to comment.