From a5a4515a71866551461e2bb86503408aae3a2472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 11 Apr 2024 10:08:52 +0200 Subject: [PATCH] [OU-IMP] l10n_be: debug info --- .../migrations/13.0.2.0/post-02-migration.py | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/addons/l10n_be/migrations/13.0.2.0/post-02-migration.py b/addons/l10n_be/migrations/13.0.2.0/post-02-migration.py index 67fa4ab00dc1..3e2642f4fb9d 100644 --- a/addons/l10n_be/migrations/13.0.2.0/post-02-migration.py +++ b/addons/l10n_be/migrations/13.0.2.0/post-02-migration.py @@ -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(