Skip to content

Commit

Permalink
Merge pull request #4425 from Tecnativa/16.0-ou_imp-account-use_in_ta…
Browse files Browse the repository at this point in the history
…x_closing

[16.0][OU-IMP] account: Rectifiy use_in_tax_closing in old repartition lines
  • Loading branch information
pedrobaeza committed May 3, 2024
2 parents 56adccb + 0758c1e commit ee7a949
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,26 @@ def _account_journal_payment_sequence(env):
)


def _fill_repartition_line_use_in_tax_closing(env):
"""This field was introduced in v14, but it was not impacting in anything noticeable
till this version, where not having this marked in the taxes lines makes that the
tax lines take the analytic dimensions no matter if the analytic field is marked or
not.
As a compromise solution, let's assign this as True for those that have no value,
which are those coming from old versions.
"""
openupgrade.logged_query(
env.cr,
"""
UPDATE account_tax_repartition_line
SET use_in_tax_closing = True
WHERE repartition_type = 'tax'
AND use_in_tax_closing IS NULL;
""",
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_xmlids(env.cr, _xmlids_renames)
Expand Down Expand Up @@ -416,3 +436,4 @@ def migrate(env, version):
)
_fast_fill_account_payment_amount_company_currency_signed(env)
_account_journal_payment_sequence(env)
_fill_repartition_line_use_in_tax_closing(env)

0 comments on commit ee7a949

Please sign in to comment.