From e52dedbfd944c8229b945e8368efd1bd94198501 Mon Sep 17 00:00:00 2001 From: emjay0921 Date: Fri, 13 Mar 2026 19:23:28 +0800 Subject: [PATCH 1/4] fix(spp_hxl_area,spp_import_match): migrate from queue_job to job_worker These two modules were missed in the original migration (PR #55). - Replace queue_job dependency with job_worker in manifests - Replace FailedJobError with UserError in spp_import_match - Remove queue_job_data.xml (queue.job.function model not in job_worker) - Update readme descriptions --- spp_hxl_area/README.rst | 62 +++++++++---------- spp_hxl_area/__manifest__.py | 2 +- spp_hxl_area/readme/DESCRIPTION.md | 4 +- spp_hxl_area/static/description/index.html | 18 +++--- spp_import_match/README.rst | 12 ++-- spp_import_match/__manifest__.py | 3 +- spp_import_match/data/queue_job_data.xml | 21 ------- spp_import_match/models/base_import.py | 5 +- spp_import_match/readme/DESCRIPTION.md | 4 +- .../static/description/index.html | 38 +++++------- .../tests/test_base_import_methods.py | 7 +-- 11 files changed, 69 insertions(+), 107 deletions(-) delete mode 100644 spp_import_match/data/queue_job_data.xml diff --git a/spp_hxl_area/README.rst b/spp_hxl_area/README.rst index 126d5696..1fa550a2 100644 --- a/spp_hxl_area/README.rst +++ b/spp_hxl_area/README.rst @@ -43,32 +43,32 @@ Key Capabilities processing → done) - Auto-sync indicators to ``spp.data.value`` for CEL expression access - Link imports to hazard incidents for disaster response tracking -- Process imports asynchronously via queue_job +- Process imports asynchronously via job_worker Key Models ~~~~~~~~~~ -+--------------------------------+-------------------------------------+ -| Model | Description | -+================================+=====================================+ -| ``spp.hxl.import.profile`` | Configuration defining area | -| | matching and rules | -+--------------------------------+-------------------------------------+ -| ``spp.hxl.aggregation.rule`` | Rule specifying what to aggregate | -| | and how | -+--------------------------------+-------------------------------------+ -| ``spp.hxl.import.batch`` | Track one execution of profile | -| | against HXL file | -+--------------------------------+-------------------------------------+ -| ``spp.hxl.import.mapping`` | Auto-detected column mapping | -| | (adjustable pre-run) | -+--------------------------------+-------------------------------------+ -| ``spp.hxl.area.indicator`` | Aggregated indicator value stored | -| | per area | -+--------------------------------+-------------------------------------+ -| ``spp.hxl.area.import.wizard`` | Wizard for uploading files and | -| | previewing matches | -+--------------------------------+-------------------------------------+ ++--------------------------------+------------------------------------+ +| Model | Description | ++================================+====================================+ +| ``spp.hxl.import.profile`` | Configuration defining area | +| | matching and rules | ++--------------------------------+------------------------------------+ +| ``spp.hxl.aggregation.rule`` | Rule specifying what to aggregate | +| | and how | ++--------------------------------+------------------------------------+ +| ``spp.hxl.import.batch`` | Track one execution of profile | +| | against HXL file | ++--------------------------------+------------------------------------+ +| ``spp.hxl.import.mapping`` | Auto-detected column mapping | +| | (adjustable pre-run) | ++--------------------------------+------------------------------------+ +| ``spp.hxl.area.indicator`` | Aggregated indicator value stored | +| | per area | ++--------------------------------+------------------------------------+ +| ``spp.hxl.area.import.wizard`` | Wizard for uploading files and | +| | previewing matches | ++--------------------------------+------------------------------------+ Configuration ~~~~~~~~~~~~~ @@ -94,15 +94,13 @@ UI Location Security ~~~~~~~~ -+----------------------------------+-----------------------------------+ -| Group | Access | -+==================================+===================================+ -| ``spp_security.group_spp_admin`` | Full CRUD on profiles, rules, | -| | indicators | -+----------------------------------+-----------------------------------+ -| ``base.group_user`` | Read profiles/rules; create/edit | -| | batches | -+----------------------------------+-----------------------------------+ ++----------------------------------+------------------------------------------+ +| Group | Access | ++==================================+==========================================+ +| ``spp_security.group_spp_admin`` | Full CRUD on profiles, rules, indicators | ++----------------------------------+------------------------------------------+ +| ``base.group_user`` | Read profiles/rules; create/edit batches | ++----------------------------------+------------------------------------------+ Extension Points ~~~~~~~~~~~~~~~~ @@ -118,7 +116,7 @@ Dependencies ~~~~~~~~~~~~ ``spp_hxl``, ``spp_area``, ``spp_cel_domain``, ``spp_hazard``, -``spp_security``, ``queue_job`` +``spp_security``, ``job_worker`` **Table of contents** diff --git a/spp_hxl_area/__manifest__.py b/spp_hxl_area/__manifest__.py index f1a05e0f..ea5bd019 100644 --- a/spp_hxl_area/__manifest__.py +++ b/spp_hxl_area/__manifest__.py @@ -17,7 +17,7 @@ "spp_cel_domain", "spp_hazard", "spp_security", - "queue_job", + "job_worker", ], "external_dependencies": { "python": [ diff --git a/spp_hxl_area/readme/DESCRIPTION.md b/spp_hxl_area/readme/DESCRIPTION.md index 30e9923b..9f13fbbe 100644 --- a/spp_hxl_area/readme/DESCRIPTION.md +++ b/spp_hxl_area/readme/DESCRIPTION.md @@ -10,7 +10,7 @@ Import HXL-tagged field data and aggregate to area-level indicators for humanita - Track imports as batches with state machine (draft → mapped → processing → done) - Auto-sync indicators to `spp.data.value` for CEL expression access - Link imports to hazard incidents for disaster response tracking -- Process imports asynchronously via queue_job +- Process imports asynchronously via job_worker ### Key Models @@ -56,4 +56,4 @@ After installing: ### Dependencies -`spp_hxl`, `spp_area`, `spp_cel_domain`, `spp_hazard`, `spp_security`, `queue_job` +`spp_hxl`, `spp_area`, `spp_cel_domain`, `spp_hazard`, `spp_security`, `job_worker` diff --git a/spp_hxl_area/static/description/index.html b/spp_hxl_area/static/description/index.html index 1395e3f4..78bf4e8a 100644 --- a/spp_hxl_area/static/description/index.html +++ b/spp_hxl_area/static/description/index.html @@ -390,15 +390,15 @@

Key Capabilities

processing → done)
  • Auto-sync indicators to spp.data.value for CEL expression access
  • Link imports to hazard incidents for disaster response tracking
  • -
  • Process imports asynchronously via queue_job
  • +
  • Process imports asynchronously via job_worker
  • Key Models

    --++ @@ -459,8 +459,8 @@

    UI Location

    Security

    Model
    --++ @@ -469,12 +469,10 @@

    Security

    - + - +
    Group
    spp_security.group_spp_adminFull CRUD on profiles, rules, -indicatorsFull CRUD on profiles, rules, indicators
    base.group_userRead profiles/rules; create/edit -batchesRead profiles/rules; create/edit batches
    @@ -493,7 +491,7 @@

    Extension Points

    Dependencies

    spp_hxl, spp_area, spp_cel_domain, spp_hazard, -spp_security, queue_job

    +spp_security, job_worker

    Table of contents

      diff --git a/spp_import_match/README.rst b/spp_import_match/README.rst index 19904698..00fadc4b 100644 --- a/spp_import_match/README.rst +++ b/spp_import_match/README.rst @@ -1,12 +1,8 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ==================== OpenSPP Import Match ==================== -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! @@ -44,7 +40,7 @@ Key Capabilities - Skip duplicate creation or update existing records when matches are found - Process imports with more than 100 records asynchronously using - ``queue_job`` + ``job_worker`` - Clear one2many/many2many associations before update to prevent duplicate entries @@ -107,7 +103,7 @@ Extension Points Dependencies ~~~~~~~~~~~~ -``base``, ``spp_base_common``, ``base_import``, ``queue_job``, +``base``, ``spp_base_common``, ``base_import``, ``job_worker``, ``spp_security`` **Table of contents** @@ -149,4 +145,4 @@ Current maintainers: This module is part of the `OpenSPP/OpenSPP2 `_ project on GitHub. -You are welcome to contribute. +You are welcome to contribute. \ No newline at end of file diff --git a/spp_import_match/__manifest__.py b/spp_import_match/__manifest__.py index d12d3578..3276a046 100644 --- a/spp_import_match/__manifest__.py +++ b/spp_import_match/__manifest__.py @@ -12,9 +12,8 @@ "license": "LGPL-3", "development_status": "Beta", "maintainers": ["jeremi", "gonzalesedwin1123"], - "depends": ["base", "spp_base_common", "base_import", "queue_job", "spp_security"], + "depends": ["base", "spp_base_common", "base_import", "job_worker", "spp_security"], "data": [ - "data/queue_job_data.xml", "security/ir.model.access.csv", "views/import_match_view.xml", ], diff --git a/spp_import_match/data/queue_job_data.xml b/spp_import_match/data/queue_job_data.xml deleted file mode 100644 index 22cc8dba..00000000 --- a/spp_import_match/data/queue_job_data.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - _split_file - - - - - _import_one_chunk - - - diff --git a/spp_import_match/models/base_import.py b/spp_import_match/models/base_import.py index 5f3ac8ea..a745c7d2 100644 --- a/spp_import_match/models/base_import.py +++ b/spp_import_match/models/base_import.py @@ -5,10 +5,9 @@ from os.path import splitext from odoo import _, models +from odoo.exceptions import UserError from odoo.models import fix_import_export_id_paths -from odoo.addons.queue_job.exception import FailedJobError - from .base import _import_match_local _logger = logging.getLogger(__name__) @@ -202,5 +201,5 @@ def _import_one_chunk(self, model_name, attachment, options, context): result = model_obj.load(fields, data) error_message = [message["message"] for message in result["messages"] if message["type"] == "error"] if error_message: - raise FailedJobError("\n".join(error_message)) + raise UserError("\n".join(error_message)) return result diff --git a/spp_import_match/readme/DESCRIPTION.md b/spp_import_match/readme/DESCRIPTION.md index 4c636005..52f80a17 100644 --- a/spp_import_match/readme/DESCRIPTION.md +++ b/spp_import_match/readme/DESCRIPTION.md @@ -6,7 +6,7 @@ Extends Odoo's base import functionality to match incoming records against exist - Match on sub-fields within related records (e.g., household ID within individual) - Apply conditional matching rules only when specific imported values are present - Skip duplicate creation or update existing records when matches are found -- Process imports with more than 100 records asynchronously using `queue_job` +- Process imports with more than 100 records asynchronously using `job_worker` - Clear one2many/many2many associations before update to prevent duplicate entries ### Key Models @@ -46,4 +46,4 @@ After installing: ### Dependencies -`base`, `spp_base_common`, `base_import`, `queue_job`, `spp_security` +`base`, `spp_base_common`, `base_import`, `job_worker`, `spp_security` diff --git a/spp_import_match/static/description/index.html b/spp_import_match/static/description/index.html index e6d71ccc..89780c85 100644 --- a/spp_import_match/static/description/index.html +++ b/spp_import_match/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +OpenSPP Import Match -
      +
      +

      OpenSPP Import Match

      - - -Odoo Community Association - -
      -

      OpenSPP Import Match