diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4cefd00cac..af6b972525 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^base_import_async/| ^queue_job_batch/| ^queue_job_cron/| ^queue_job_cron_jobrunner/| diff --git a/base_import_async/__manifest__.py b/base_import_async/__manifest__.py index 5432d7c5ca..58dd6eb8b0 100644 --- a/base_import_async/__manifest__.py +++ b/base_import_async/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Asynchronous Import", "summary": "Import CSV files in the background", - "version": "18.0.1.0.0", + "version": "19.0.1.0.0", "author": "Akretion, ACSONE SA/NV, Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/queue", @@ -20,6 +20,6 @@ "base_import_async/static/src/xml/import_data_sidepanel.xml", ], }, - "installable": False, + "installable": True, "development_status": "Production/Stable", } diff --git a/base_import_async/models/base_import_import.py b/base_import_async/models/base_import_import.py index 856828a593..c655572413 100644 --- a/base_import_async/models/base_import_import.py +++ b/base_import_async/models/base_import_import.py @@ -9,7 +9,7 @@ from io import BytesIO, StringIO, TextIOWrapper from os.path import splitext -from odoo import _, api, models +from odoo import models from odoo.models import fix_import_export_id_paths from odoo.addons.base_import.models.base_import import ImportValidationError @@ -30,6 +30,7 @@ DEFAULT_CHUNK_SIZE = 100 +# pylint: disable=no-wizard-in-models class BaseImportImport(models.TransientModel): _inherit = "base_import.import" @@ -55,10 +56,11 @@ def execute_import(self, fields, columns, options, dryrun=False): translated_model_name = search_result[0][1] else: translated_model_name = self._description - description = _("Import %(model)s from file %(from_file)s") % { - "model": translated_model_name, - "from_file": self.file_name, - } + description = self.env._( + "Import %(model)s from file %(from_file)s", + model=translated_model_name, + from_file=self.file_name, + ) attachment = self._create_csv_attachment( import_fields, data, options, self.file_name ) @@ -78,7 +80,6 @@ def _link_attachment_to_job(self, delayed_job, attachment): ) attachment.write({"res_model": "queue.job", "res_id": queue_job.id}) - @api.returns("ir.attachment") def _create_csv_attachment(self, fields, data, options, file_name): # write csv f = StringIO() @@ -155,16 +156,15 @@ def _split_file( model_obj, fields, data, chunk_size ): chunk = str(priority - INIT_PRIORITY).zfill(padding) - description = _( + description = self.env._( "Import %(model)s from file %(file_name)s - " - "#%(chunk)s - lines %(from)s to %(to)s" - ) % { - "model": translated_model_name, - "file_name": file_name, - "chunk": chunk, - "from": row_from + 1 + header_offset, - "to": row_to + 1 + header_offset, - } + "#%(chunk)s - lines %(row_from)s to %(row_to)s", + model=translated_model_name, + file_name=file_name, + chunk=chunk, + row_from=row_from + 1 + header_offset, + row_to=row_to + 1 + header_offset, + ) # create a CSV attachment and enqueue the job root, ext = splitext(file_name) attachment = self._create_csv_attachment( diff --git a/base_import_async/models/queue_job.py b/base_import_async/models/queue_job.py index b7313505f3..f3034e9d54 100644 --- a/base_import_async/models/queue_job.py +++ b/base_import_async/models/queue_job.py @@ -1,7 +1,7 @@ # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, models +from odoo import models class QueueJob(models.Model): @@ -11,7 +11,7 @@ class QueueJob(models.Model): def _related_action_attachment(self): return { - "name": _("Attachment"), + "name": self.env._("Attachment"), "type": "ir.actions.act_window", "res_model": "ir.attachment", "view_mode": "form", diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index d816e8ea04..f008a75218 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -2,6 +2,7 @@ name = "odoo-addons-oca-queue" version = "19.0.20260104.0" dependencies = [ + "odoo-addon-base_import_async==19.0.*", "odoo-addon-queue_job==19.0.*", "odoo-addon-test_queue_job==19.0.*", ]