Skip to content

Commit

Permalink
[OU-IMP] l10n_be: debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
remytms committed Apr 11, 2024
1 parent 53c9969 commit a5a4515
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions addons/l10n_be/migrations/13.0.2.0/post-02-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,45 @@ def update_tags_on_move_line(env):
# then it's a base line, so apply base repartition line from
# taxes.
elif tax_ids and not tax_base_amount:
repartition_line_ids = env["account.tax.repartition.line"]
_logger.info(
"Processing %s", move_line_id
)
taxes = tax_ids | tax_ids.mapped("children_tax_ids")
_logger.info(
"Found taxes: %s",
taxes
)
if "invoice" in move_id.type:
repartition_line_ids = tax_ids.mapped(
repartition_line_ids = taxes.mapped(
"invoice_repartition_line_ids"
)
elif "refund" in move_id.type:
repartition_line_ids = tax_ids.mapped(
repartition_line_ids = taxes.mapped(
"refund_repartition_line_ids"
)
else:
repartition_line_ids = env["account.tax.repartition.line"]
_logger.info(
"Found repartition line: %s",
repartition_line_ids
)
base_repartition_ids = repartition_line_ids.filtered(
lambda r: r.repartition_type == "base"
)
_logger.info(
"Found base repartition line: %s",
base_repartition_ids
)
new_tag_ids = base_repartition_ids.mapped("tag_ids")
_logger.info(
"Applying new tags %s on %s",
new_tag_ids,
move_line_id,
)

else:
new_tag_ids = env["account.account.tag"]
_logger.info("No tag to apply on %s", move_line_id)

# Write new tags
openupgrade.logged_query(
Expand Down

0 comments on commit a5a4515

Please sign in to comment.