-
-
Notifications
You must be signed in to change notification settings - Fork 532
[19.0] [MIG] queue_job: migrate + tests #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.0
Are you sure you want to change the base?
Changes from all commits
2a5ccb8
ce67593
b283cd8
df50b83
b7129d7
ac812d7
a7d4364
4da9fae
f494bcc
3b733f1
ee67632
d827d58
9aeebee
9ac6b25
99cc44f
211e467
620413a
82d62a1
81a1488
6d330f2
f685d12
d27f83d
8dd4af0
231705d
9ea78c5
038c334
96a9ada
afc9c76
f947199
c30bf4b
123900c
d25ff12
754e438
ae5a9eb
0ae333a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,10 +55,9 @@ 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 = _( | ||
| "Import %s from file %s", translated_model_name, self.file_name | ||
| ) | ||
| attachment = self._create_csv_attachment( | ||
| import_fields, data, options, self.file_name | ||
| ) | ||
|
|
@@ -156,16 +155,13 @@ def _split_file( | |
| ): | ||
| chunk = str(priority - INIT_PRIORITY).zfill(padding) | ||
| description = _( | ||
| "Import %(model)s from file %(file_name)s - " | ||
| "#%(chunk)s - lines %(from)s to %(to)s" | ||
| "Import %s from file %s - #%s - lines %s to %s", | ||
| translated_model_name, | ||
| file_name, | ||
| chunk, | ||
| row_from + 1 + header_offset, | ||
| row_to + 1 + header_offset, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, please don't change the source string. |
||
| ) | ||
| description = description % { | ||
| "model": translated_model_name, | ||
| "file_name": file_name, | ||
| "chunk": chunk, | ||
| "from": row_from + 1 + header_offset, | ||
| "to": row_to + 1 + header_offset, | ||
| } | ||
| # create a CSV attachment and enqueue the job | ||
| root, ext = splitext(file_name) | ||
| attachment = self._create_csv_attachment( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -472,11 +472,10 @@ def from_environ_or_config(cls): | |||||
| return runner | ||||||
|
|
||||||
| def get_db_names(self): | ||||||
| if config["db_name"]: | ||||||
| db_names = config["db_name"].split(",") | ||||||
| else: | ||||||
| db_names = odoo.service.db.list_dbs(True) | ||||||
| return db_names | ||||||
| db_names = config["db_name"] or [] | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's superfluous. |
||||||
| if db_names: | ||||||
| return list(db_names) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's already a list, no? |
||||||
| return odoo.service.db.list_dbs(True) | ||||||
|
|
||||||
| def close_databases(self, remove_jobs=True): | ||||||
| for db_name, db in self.db_by_name.items(): | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to
1/ keep the source string unchanged
2/ use keyword placeholders so it can be translated to languages that need another order of the words