From 1f13d26b814d29909f5094f387a974a0051eadfa Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 20:59:59 +0000 Subject: [PATCH 1/2] fix(import): Update progress bar for m2m relations The progress bar for 'many2many' relational imports was not updating because the `run_write_tuple_import` function, which handles these updates, did not report its progress. This change addresses the issue by: - Passing the `progress` and `task_id` objects from `run_write_tuple_import` to the `_create_relational_records` function. - Updating `_create_relational_records` to use these objects to reset the progress bar's total and advance it for each batch of records processed. This ensures that the progress bar now accurately reflects the status of `many2many` relational imports. --- src/odoo_data_flow/lib/relational_import.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/odoo_data_flow/lib/relational_import.py b/src/odoo_data_flow/lib/relational_import.py index 9b588f7d..3d35abb7 100644 --- a/src/odoo_data_flow/lib/relational_import.py +++ b/src/odoo_data_flow/lib/relational_import.py @@ -509,6 +509,8 @@ def run_write_tuple_import( related_model_df, original_filename, batch_size, + progress, + task_id, ) @@ -525,6 +527,8 @@ def _create_relational_records( related_model_df: pl.DataFrame, original_filename: str, batch_size: int, + progress: Progress, + task_id: TaskID, ) -> bool: """Create records in the relational table. @@ -546,6 +550,8 @@ def _create_relational_records( related_model_df: DataFrame with related model IDs original_filename: The original filename batch_size: The batch size for processing + progress: The rich Progress object. + task_id: The TaskID for the current progress bar. Returns: True if successful, False otherwise @@ -601,6 +607,9 @@ def _create_relational_records( successful_updates = 0 failed_records_to_report = [] + # Reset the progress bar for this specific field's updates + progress.update(task_id, total=len(grouped_data), completed=0) + # Update each owning record with its many2many field values for owning_id, related_ids in grouped_data.items(): try: @@ -612,6 +621,7 @@ def _create_relational_records( # Update the owning record with the many2many field owning_model.write([owning_id], {field: m2m_command}) successful_updates += 1 + progress.update(task_id, advance=1) except Exception as e: log.error( From b179a0cc632c8daa791f3265af74b4d57b81837b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 21:11:44 +0000 Subject: [PATCH 2/2] fix(import): Update progress bar for m2m relations The progress bar for 'many2many' relational imports was not updating because the `run_write_tuple_import` function, which handles these updates, did not report its progress. This change addresses the issue by: - Passing the `progress` and `task_id` objects from `run_write_tuple_import` to the `_create_relational_records` function. - Updating `_create_relational_records` to use these objects to reset the progress bar's total and advance it for each batch of records processed. This ensures that the progress bar now accurately reflects the status of `many2many` relational imports.