|
9 | 9 | from io import BytesIO, StringIO, TextIOWrapper |
10 | 10 | from os.path import splitext |
11 | 11 |
|
12 | | -from odoo import _, models |
| 12 | +from odoo import models |
13 | 13 | from odoo.models import fix_import_export_id_paths |
14 | 14 |
|
15 | 15 | from odoo.addons.base_import.models.base_import import ImportValidationError |
@@ -63,10 +63,11 @@ def execute_import(self, fields, columns, options, dryrun=False): |
63 | 63 | translated_model_name = search_result[0][1] |
64 | 64 | else: |
65 | 65 | translated_model_name = self._description |
66 | | - description = _("Import %(model)s from file %(from_file)s") % { |
67 | | - "model": translated_model_name, |
68 | | - "from_file": self.file_name, |
69 | | - } |
| 66 | + description = self.env._( |
| 67 | + "Import %(model)s from file %(from_file)s", |
| 68 | + model=translated_model_name, |
| 69 | + from_file=self.file_name, |
| 70 | + ) |
70 | 71 | attachment = self._create_csv_attachment( |
71 | 72 | import_fields, data, options, self.file_name |
72 | 73 | ) |
@@ -162,16 +163,15 @@ def _split_file( |
162 | 163 | model_obj, fields, data, chunk_size |
163 | 164 | ): |
164 | 165 | chunk = str(priority - INIT_PRIORITY).zfill(padding) |
165 | | - description = _( |
166 | | - "Import %(model)s from file %(file_name)s - " |
167 | | - "#%(chunk)s - lines %(from)s to %(to)s" |
168 | | - ) % { |
169 | | - "model": translated_model_name, |
170 | | - "file_name": file_name, |
171 | | - "chunk": chunk, |
172 | | - "from": row_from + 1 + header_offset, |
173 | | - "to": row_to + 1 + header_offset, |
174 | | - } |
| 166 | + description = self.env._( |
| 167 | + "Import %(model)s from file %(file_name)s - #%(chunk)s - " |
| 168 | + "lines %(from_line)s to %(to_line)s", |
| 169 | + model=translated_model_name, |
| 170 | + file_name=file_name, |
| 171 | + chunk=chunk, |
| 172 | + from_line=row_from + 1 + header_offset, |
| 173 | + to_line=row_to + 1 + header_offset, |
| 174 | + ) |
175 | 175 | # create a CSV attachment and enqueue the job |
176 | 176 | root, ext = splitext(file_name) |
177 | 177 | attachment = self._create_csv_attachment( |
|
0 commit comments