Skip to content

Commit 6f6439b

Browse files
committed
Merge PR #699 into 18.0
Signed-off-by simahawk
2 parents 23dddc5 + ca4ebd2 commit 6f6439b

24 files changed

Lines changed: 1477 additions & 0 deletions

base_import_async/README.rst

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
===================
2+
Asynchronous Import
3+
===================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:e7bcaae80fd59cc8e45b2784606eb026fba7dfcac892ad4a986f51e0dc248e1e
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
20+
:target: https://github.com/OCA/queue/tree/18.0/base_import_async
21+
:alt: OCA/queue
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-base_import_async
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the standard CSV import functionality to import
32+
files in the background using the OCA/queue framework.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
The user is presented with a new checkbox in the import screen. When
43+
selected, the import is delayed in a background job.
44+
45+
This job in turn splits the CSV file in chunks of minimum 100 lines (or
46+
more to align with record boundaries). Each chunk is then imported in a
47+
separate background job.
48+
49+
When an import fails, the job is marked as such and the user can read
50+
the error in the job status. The CSV chunk being imported is stored as
51+
an attachment to the job, making it easy to download it, fix it and run
52+
a new import, possibly in synchronous mode since the chunks are small.
53+
54+
Any file that can be imported by the standard import mechanism can also
55+
be imported in the background.
56+
57+
This module's scope is limited to making standard imports asynchronous.
58+
It does not attempt to transform the data nor automate ETL flows.
59+
60+
Other modules may benefit from this infrastructure in the following way
61+
(as illustrated in the test suite):
62+
63+
1. create an instance of base_import.import and populate its fields
64+
(res_model, file, file_name),
65+
2. invoke the do method with appropriate options (header, encoding,
66+
separator, quoting, use_queue, chunk_size).
67+
68+
Known issues / Roadmap
69+
======================
70+
71+
- There is currently no user interface to control the chunk size, which
72+
is currently 100 by default. Should this proves to be an issue, it is
73+
easy to add an option to extend the import screen.
74+
- Validation cannot be run in the background.
75+
76+
Changelog
77+
=========
78+
79+
13.0.1.0.0 (2019-12-20)
80+
-----------------------
81+
82+
- [MIGRATION] from 12.0 branched at rev. a7f8031
83+
84+
Bug Tracker
85+
===========
86+
87+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_.
88+
In case of trouble, please check there if your issue has already been reported.
89+
If you spotted it first, help us to smash it by providing a detailed and welcomed
90+
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20base_import_async%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
91+
92+
Do not contact contributors directly about support or help with technical issues.
93+
94+
Credits
95+
=======
96+
97+
Authors
98+
-------
99+
100+
* Akretion
101+
* ACSONE SA/NV
102+
103+
Contributors
104+
------------
105+
106+
Sébastien Beau (Akretion) authored the initial prototype.
107+
108+
Stéphane Bidoul (ACSONE) extended it to version 1.0 to support
109+
multi-line records, store data to import as attachments and let the user
110+
control the asynchronous behaviour.
111+
112+
Other contributors include:
113+
114+
- Anthony Muschang (ACSONE)
115+
116+
- David Béal (Akretion)
117+
118+
- Jonathan Nemry (ACSONE)
119+
120+
- Laurent Mignon (ACSONE)
121+
122+
- Dennis Sluijk (Onestein)
123+
124+
- Guewen Baconnier (Camptocamp)
125+
126+
- `Trobz <https://trobz.com>`__:
127+
128+
- Dzung Tran <dungtd@trobz.com>
129+
- Do Anh Duy <duyda@trobz.com>
130+
131+
- Daniel Duque (FactorLibre)
132+
133+
Other credits
134+
-------------
135+
136+
The migration of this module from 17.0 to 18.0 was financially supported
137+
by Camptocamp
138+
139+
Maintainers
140+
-----------
141+
142+
This module is maintained by the OCA.
143+
144+
.. image:: https://odoo-community.org/logo.png
145+
:alt: Odoo Community Association
146+
:target: https://odoo-community.org
147+
148+
OCA, or the Odoo Community Association, is a nonprofit organization whose
149+
mission is to support the collaborative development of Odoo features and
150+
promote its widespread use.
151+
152+
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/18.0/base_import_async>`_ project on GitHub.
153+
154+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

base_import_async/__init__.py

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 models

base_import_async/__manifest__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
2+
# @author Sébastien BEAU <sebastien.beau@akretion.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Asynchronous Import",
7+
"summary": "Import CSV files in the background",
8+
"version": "18.0.1.0.0",
9+
"author": "Akretion, ACSONE SA/NV, Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"website": "https://github.com/OCA/queue",
12+
"category": "Generic Modules",
13+
"depends": ["base_import", "queue_job"],
14+
"data": [
15+
"data/queue_job_function_data.xml",
16+
],
17+
"assets": {
18+
"web.assets_backend": [
19+
"base_import_async/static/src/js/import_model.esm.js",
20+
"base_import_async/static/src/xml/import_data_sidepanel.xml",
21+
],
22+
},
23+
"installable": True,
24+
"development_status": "Production/Stable",
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<odoo noupdate="1">
2+
<record id="job_function_base_import_import_split_file" model="queue.job.function">
3+
<field name="model_id" ref="base_import.model_base_import_import" />
4+
<field name="method">_split_file</field>
5+
<field
6+
name="related_action"
7+
eval='{"func_name": "_related_action_attachment"}'
8+
/>
9+
</record>
10+
<record
11+
id="job_function_base_import_import_import_one_chunk"
12+
model="queue.job.function"
13+
>
14+
<field name="model_id" ref="base_import.model_base_import_import" />
15+
<field name="method">_import_one_chunk</field>
16+
<field
17+
name="related_action"
18+
eval='{"func_name": "_related_action_attachment"}'
19+
/>
20+
</record>
21+
</odoo>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * base_import_async
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: base_import_async
17+
#. odoo-python
18+
#: code:addons/base_import_async/models/queue_job.py:0
19+
#, python-format
20+
msgid "Attachment"
21+
msgstr ""
22+
23+
#. module: base_import_async
24+
#: model:ir.model,name:base_import_async.model_base_import_import
25+
msgid "Base Import"
26+
msgstr ""
27+
28+
#. module: base_import_async
29+
#. odoo-python
30+
#: code:addons/base_import_async/models/base_import_import.py:0
31+
#, python-format
32+
msgid ""
33+
"Import %(model)s from file %(file_name)s - #%(chunk)s - lines %(from)s to "
34+
"%(to)s"
35+
msgstr ""
36+
37+
#. module: base_import_async
38+
#. odoo-python
39+
#: code:addons/base_import_async/models/base_import_import.py:0
40+
#, python-format
41+
msgid "Import %(model)s from file %(from_file)s"
42+
msgstr ""
43+
44+
#. module: base_import_async
45+
#. odoo-javascript
46+
#: code:addons/base_import_async/static/src/xml/import.xml:0
47+
#, python-format
48+
msgid "Import in the background"
49+
msgstr ""
50+
51+
#. module: base_import_async
52+
#: model:ir.model,name:base_import_async.model_queue_job
53+
msgid "Queue Job"
54+
msgstr ""
55+
56+
#. module: base_import_async
57+
#. odoo-javascript
58+
#: code:addons/base_import_async/static/src/xml/import.xml:0
59+
#, python-format
60+
msgid ""
61+
"When checked, the import will be executed as a background job, after "
62+
"splitting your file in small chunks that will be processed independently. "
63+
"Use this to import very large files."
64+
msgstr ""
65+
66+
#. module: base_import_async
67+
#. odoo-javascript
68+
#: code:addons/base_import_async/static/src/js/import.js:0
69+
#, python-format
70+
msgid "You can check the status of this job in menu 'Queue / Jobs'."
71+
msgstr ""
72+
73+
#. module: base_import_async
74+
#. odoo-javascript
75+
#: code:addons/base_import_async/static/src/js/import.js:0
76+
#, python-format
77+
msgid "Your request is being processed"
78+
msgstr ""

base_import_async/i18n/es.po

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * base_import_async
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2023-09-25 09:34+0000\n"
10+
"Last-Translator: Asier Neira <asier_neira@hotmail.com>\n"
11+
"Language-Team: none\n"
12+
"Language: es\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: base_import_async
20+
#. odoo-python
21+
#: code:addons/base_import_async/models/queue_job.py:0
22+
#, python-format
23+
msgid "Attachment"
24+
msgstr "Archivo adjunto"
25+
26+
#. module: base_import_async
27+
#: model:ir.model,name:base_import_async.model_base_import_import
28+
msgid "Base Import"
29+
msgstr "Importación Base"
30+
31+
#. module: base_import_async
32+
#. odoo-python
33+
#: code:addons/base_import_async/models/base_import_import.py:0
34+
#, python-format
35+
msgid ""
36+
"Import %(model)s from file %(file_name)s - #%(chunk)s - lines %(from)s to "
37+
"%(to)s"
38+
msgstr ""
39+
"Importar %(model)s del archivo %(file_name)s - #%(chunk)s - líneas %(from)s "
40+
"a %(to)s"
41+
42+
#. module: base_import_async
43+
#. odoo-python
44+
#: code:addons/base_import_async/models/base_import_import.py:0
45+
#, python-format
46+
msgid "Import %(model)s from file %(from_file)s"
47+
msgstr "Importar %(model)s del fichero %(from_file)s"
48+
49+
#. module: base_import_async
50+
#. odoo-javascript
51+
#: code:addons/base_import_async/static/src/xml/import.xml:0
52+
#, python-format
53+
msgid "Import in the background"
54+
msgstr "Importación en segundo plano"
55+
56+
#. module: base_import_async
57+
#: model:ir.model,name:base_import_async.model_queue_job
58+
msgid "Queue Job"
59+
msgstr "Cola de trabajo"
60+
61+
#. module: base_import_async
62+
#. odoo-javascript
63+
#: code:addons/base_import_async/static/src/xml/import.xml:0
64+
#, python-format
65+
msgid ""
66+
"When checked, the import will be executed as a background job, after "
67+
"splitting your file in small chunks that will be processed independently. "
68+
"Use this to import very large files."
69+
msgstr ""
70+
"Si esta opción está seleccionada, la importación se ejecutará como un "
71+
"trabajo en segundo plano, tras dividir el archivo en pequeños trozos que se "
72+
"procesarán de forma independiente. Utilícelo para importar archivos muy "
73+
"grandes."
74+
75+
#. module: base_import_async
76+
#. odoo-javascript
77+
#: code:addons/base_import_async/static/src/js/import.js:0
78+
#, python-format
79+
msgid "You can check the status of this job in menu 'Queue / Jobs'."
80+
msgstr ""
81+
"Puede comprobar el estado de este trabajo en el menú 'Cola / Trabajos'."
82+
83+
#. module: base_import_async
84+
#. odoo-javascript
85+
#: code:addons/base_import_async/static/src/js/import.js:0
86+
#, python-format
87+
msgid "Your request is being processed"
88+
msgstr "Su solicitud está siendo procesada"

0 commit comments

Comments
 (0)