Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
Rad0van committed May 26, 2022
1 parent 9376b49 commit 24791f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
22 changes: 12 additions & 10 deletions base_import_async/models/base_import_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def execute_import(self, fields, columns, options, dryrun=False):
translated_model_name = search_result[0][1]
else:
translated_model_name = self._description
description = _("Import %s from file %s") % (
translated_model_name,
self.file_name,
description = _(
"Import %(translated_model_name)s from file %(file_name)s",
translated_model_name=translated_model_name,
file_name=self.file_name,
)
file_name = self.file_name
if not file_name.endswith(".csv"):
Expand Down Expand Up @@ -152,13 +153,14 @@ def _split_file(
model_obj, fields, data, chunk_size
):
chunk = str(priority - INIT_PRIORITY).zfill(padding)
description = _("Import %s from file %s - #%s - lines %s to %s")
description = description % (
translated_model_name,
file_name,
chunk,
row_from + 1 + header_offset,
row_to + 1 + header_offset,
description = _(
"Import %(translated_model_name)s from file %(file_name)s"
" - #%(chunk)s - lines %(row_from)s to %(row_to)s",
translated_model_name=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)
Expand Down
11 changes: 9 additions & 2 deletions base_import_async/static/src/xml/import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
after splitting your file in small chunks that will be processed independently.
Use this to import very large files."
>
<input type="checkbox" class="oe_import_queue" id="oe_import_queue" />
<label for="oe_import_queue">Import in the background</label>
<input
type="checkbox"
class="oe_import_queue custom-control-input"
id="oe_import_queue"
/>
<label
for="oe_import_queue"
class="custom-control-label"
>Import in the background</label>
</div>
</t>
</t>
Expand Down

0 comments on commit 24791f3

Please sign in to comment.