Skip to content

Commit 1d0a8ac

Browse files
committed
[FIX] base_import_async: satisfy pylint checks
1 parent 0261dca commit 1d0a8ac

6 files changed

Lines changed: 22 additions & 19 deletions

File tree

base_import_async/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
22

33
from . import models
4+
from . import wizards
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
22

3-
from . import base_import_import
43
from . import queue_job

base_import_async/models/queue_job.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2017 ACSONE SA/NV
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

4-
from odoo import _, models
4+
from odoo import models
55

66

77
class QueueJob(models.Model):
@@ -17,7 +17,7 @@ def _related_action_attachment(self):
1717
if not attachment:
1818
return None
1919
return {
20-
"name": _("Attachment"),
20+
"name": self.env._("Attachment"),
2121
"type": "ir.actions.act_window",
2222
"res_model": "ir.attachment",
2323
"view_mode": "form",

base_import_async/tests/test_base_import_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from odoo.addons.queue_job.tests.common import trap_jobs
1212

13-
from ..models.base_import_import import OPT_USE_QUEUE
13+
from ..wizards.base_import_import import OPT_USE_QUEUE
1414

1515

1616
class TestBaseImportImport(TransactionCase):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import base_import_import

base_import_async/models/base_import_import.py renamed to base_import_async/wizards/base_import_import.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from io import BytesIO, StringIO, TextIOWrapper
1010
from os.path import splitext
1111

12-
from odoo import _, models
12+
from odoo import models
1313
from odoo.models import fix_import_export_id_paths
1414

1515
from odoo.addons.base_import.models.base_import import ImportValidationError
@@ -63,10 +63,11 @@ def execute_import(self, fields, columns, options, dryrun=False):
6363
translated_model_name = search_result[0][1]
6464
else:
6565
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+
)
7071
attachment = self._create_csv_attachment(
7172
import_fields, data, options, self.file_name
7273
)
@@ -162,16 +163,15 @@ def _split_file(
162163
model_obj, fields, data, chunk_size
163164
):
164165
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+
)
175175
# create a CSV attachment and enqueue the job
176176
root, ext = splitext(file_name)
177177
attachment = self._create_csv_attachment(

0 commit comments

Comments
 (0)