Skip to content

Commit

Permalink
[MIG] base_import_async: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviedoanhduy committed Oct 28, 2024
1 parent a50da34 commit 0bc3ef9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion base_import_async/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ Other contributors include:
- `Trobz <https://trobz.com>`__:

- Dzung Tran <[email protected]>
- Do Anh Duy <[email protected]>

- Daniel Duque (FactorLibre)

Other credits
-------------

The migration of this module from 15.0 to 16.0 was financially supported
The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp

Maintainers
Expand Down
2 changes: 1 addition & 1 deletion 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": "17.0.1.0.0",
"version": "18.0.1.0.0",
"author": "Akretion, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/queue",
Expand Down
5 changes: 3 additions & 2 deletions base_import_async/models/base_import_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from odoo import _, api, models
from odoo.models import fix_import_export_id_paths

from odoo.addons.base_import.models.base_import import ImportValidationError
from odoo.addons.queue_job.exception import FailedJobError

# options defined in base_import/import.js
Expand Down Expand Up @@ -42,8 +43,8 @@ def execute_import(self, fields, columns, options, dryrun=False):
data, import_fields = self._convert_import_data(fields, options)
# Parse date and float field
data = self._parse_import_data(data, import_fields, options)
except ValueError as e:
return {"messages": [{"type": "error", "message": str(e), "record": False}]}
except (ImportValidationError, ValueError) as e:
return {"messages": [e.__dict__]}

# get the translated model name to build
# a meaningful job description
Expand Down
3 changes: 2 additions & 1 deletion base_import_async/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Other contributors include:

- Guewen Baconnier (Camptocamp)

- [Trobz](https://trobz.com):
- [Trobz](https://trobz.com):
- Dzung Tran \<<[email protected]>\>
- Do Anh Duy \<<[email protected]>\>

- Daniel Duque (FactorLibre)
2 changes: 1 addition & 1 deletion base_import_async/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The migration of this module from 15.0 to 16.0 was financially supported
The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp
3 changes: 2 additions & 1 deletion base_import_async/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,15 @@ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<li>Guewen Baconnier (Camptocamp)</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Dzung Tran &lt;<a class="reference external" href="mailto:dungtd&#64;trobz.com">dungtd&#64;trobz.com</a>&gt;</li>
<li>Do Anh Duy &lt;<a class="reference external" href="mailto:duyda&#64;trobz.com">duyda&#64;trobz.com</a>&gt;</li>
</ul>
</li>
<li>Daniel Duque (FactorLibre)</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-9">Other credits</a></h2>
<p>The migration of this module from 15.0 to 16.0 was financially supported
<p>The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
Expand Down
6 changes: 2 additions & 4 deletions base_import_async/static/src/js/import_model.esm.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/** @odoo-module **/

import {BaseImportModel} from "@base_import/import_model";
import {_t} from "@web/core/l10n/translation";
import {patch} from "@web/core/utils/patch";

patch(BaseImportModel.prototype, {
get importOptions() {
const options = super.importOptions;
const checkbox = document.querySelector("input.oe_import_queue");
const checkbox = document.querySelector("#oe_import_queue");
options.use_queue = checkbox ? checkbox.checked : false;
return options;
},

async executeImport(isTest, totalSteps, importProgress) {
const def = super.executeImport(isTest, totalSteps, importProgress);
const checkbox = document.querySelector("input.oe_import_queue");
const checkbox = document.querySelector("#oe_import_queue");
if (checkbox && checkbox.checked && !isTest) {
this._addMessage("warning", [
_t("Your request is being processed"),
Expand Down
3 changes: 2 additions & 1 deletion base_import_async/static/src/xml/import_data_sidepanel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<templates xml:space="preserve">
<t
t-name="base_import_async.ImportDataSidepanel"
t-inherit="base_import.ImportDataSidepanel"
t-inherit="ImportDataSidepanel"
t-inherit-mode="extension"
>
<xpath expr="//CheckBox" position="before">
<div
class="o-checkbox form-check"
title="When checked, the import will be executed as a background job,
after splitting your file in small chunks that will be processed independently.
Use this to import very large files."
Expand Down

0 comments on commit 0bc3ef9

Please sign in to comment.