Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^base_import_async/|
^queue_job_batch/|
^queue_job_cron/|
^queue_job_cron_jobrunner/|
Expand Down
4 changes: 2 additions & 2 deletions base_import_async/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,6 +20,6 @@
"base_import_async/static/src/xml/import_data_sidepanel.xml",
],
},
"installable": False,
"installable": True,
"development_status": "Production/Stable",
}
30 changes: 15 additions & 15 deletions base_import_async/models/base_import_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,6 +30,7 @@
DEFAULT_CHUNK_SIZE = 100


# pylint: disable=no-wizard-in-models
class BaseImportImport(models.TransientModel):
_inherit = "base_import.import"

Expand All @@ -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
)
Expand All @@ -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()
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions base_import_async/models/queue_job.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions setup/_metapackage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
]
Expand Down
Loading