Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Convert tax tags based on move type instead of amount. #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions openupgradelib/openupgrade_130.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ def convert_old_style_tax_tag_to_new(
UPDATE account_account_tag_account_move_line_rel r
SET account_account_tag_id = %s
FROM account_move_line aml
LEFT JOIN account_move am ON am.id = aml.account_id
WHERE
r.account_move_line_id = aml.id AND
aml.debit >= 0 AND
am.type IN ('out_invoice', 'in_invoice') AND
r.account_account_tag_id = %s
""",
(new_debit_tag_id, old_tag_id),
Expand All @@ -114,9 +115,10 @@ def convert_old_style_tax_tag_to_new(
UPDATE account_account_tag_account_move_line_rel r
SET account_account_tag_id = %s
FROM account_move_line aml
LEFT JOIN account_move am ON am.id = aml.account_id
WHERE
r.account_move_line_id = aml.id AND
aml.credit > 0 AND
am.type IN ('out_refund', 'in_refund') AND
r.account_account_tag_id = %s
""",
(new_credit_tag_id, old_tag_id),
Expand Down
Loading