Skip to content

Commit

Permalink
[16.0][MIG] base_import_async: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dzungtran89 committed Mar 17, 2023
1 parent 359ee15 commit 27318ae
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 25 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^base_export_async/|
^base_import_async/|
^queue_job_subscribe/|
^test_base_import_async/|
# END NOT INSTALLABLE ADDONS
Expand Down
21 changes: 14 additions & 7 deletions base_import_async/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Asynchronous Import
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
:target: https://github.com/OCA/queue/tree/14.0/base_import_async
:target: https://github.com/OCA/queue/tree/16.0/base_import_async
:alt: OCA/queue
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-base_import_async
:target: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_import_async
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/230/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/queue&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Expand Down Expand Up @@ -89,7 +89,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20base_import_async%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20base_import_async%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -119,6 +119,13 @@ Other contributors include:
* Laurent Mignon (ACSONE)
* Dennis Sluijk (Onestein)
* Guewen Baconnier (Camptocamp)
* `Trobz <https://trobz.com>`_:
* Dzung Tran <[email protected]>

Other credits
~~~~~~~~~~~~~

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

Maintainers
~~~~~~~~~~~
Expand All @@ -133,6 +140,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/14.0/base_import_async>`_ project on GitHub.
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/16.0/base_import_async>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 3 additions & 5 deletions 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": "15.0.1.0.1",
"version": "16.0.1.0.0",
"author": "Akretion, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/queue",
Expand All @@ -15,11 +15,9 @@
"data/queue_job_function_data.xml",
],
"assets": {
"web.assets_qweb": [
"base_import_async/static/src/xml/import.xml",
],
"web.assets_backend": [
"/base_import_async/static/src/js/import.js",
"base_import_async/static/src/js/import.js",
"base_import_async/static/src/xml/import.xml",
],
},
"installable": True,
Expand Down
25 changes: 14 additions & 11 deletions base_import_async/models/base_import_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +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 %(model)s from file %(from_file)s") % {
"model": translated_model_name,
"from_file": self.file_name,
}
attachment = self._create_csv_attachment(
import_fields, data, options, self.file_name
)
Expand Down Expand Up @@ -144,14 +144,17 @@ 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 %(model)s from file %(file_name)s - "
"#%(chunk)s - lines %(from)s to %(to)s"
)
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(
Expand Down
2 changes: 2 additions & 0 deletions base_import_async/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Other contributors include:
* Laurent Mignon (ACSONE)
* Dennis Sluijk (Onestein)
* Guewen Baconnier (Camptocamp)
* `Trobz <https://trobz.com>`_:
* Dzung Tran <[email protected]>
1 change: 1 addition & 0 deletions base_import_async/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp
2 changes: 1 addition & 1 deletion base_import_async/static/src/xml/import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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" />
<input type="checkbox" class="form-check-input" id="oe_import_queue" />
<label for="oe_import_queue">Import in the background</label>
</div>
</t>
Expand Down

0 comments on commit 27318ae

Please sign in to comment.