diff --git a/.copier-answers.yml b/.copier-answers.yml index 2246d02358..525fcf78b5 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,13 +1,26 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.0.3 +_commit: v1.29 _src_path: gh:oca/oca-addons-repo-template -dependency_installation_mode: PIP +ci: GitHub +convert_readme_fragments_to_markdown: false +enable_checklog_odoo: false generate_requirements_txt: true +github_check_license: true +github_ci_extra_env: {} +github_enable_codecov: true +github_enable_makepot: true +github_enable_stale_action: true +github_enforce_dev_status_compatibility: true include_wkhtmltopdf: false +odoo_test_flavor: Both odoo_version: 14.0 +org_name: Odoo Community Association (OCA) +org_slug: OCA rebel_module_groups: [] -repo_description: "TODO: add repo description." +repo_description: Advanced async jobs management for Odoo repo_name: queue repo_slug: queue -travis_apt_packages: [] -travis_apt_sources: [] +repo_website: https://github.com/OCA/queue +use_pyproject_toml: false +use_ruff: false + diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881b4c..fed88d70d2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,16 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2017 + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module # Globals available in Odoo that shouldn't produce errorings globals: @@ -14,7 +21,8 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: readonly + luxon: readonly # Styling is handled by Prettier, so we only need to enable AST rules; # see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 diff --git a/.flake8 b/.flake8 index 44ed868f7f..e397e8ed4e 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -max-line-length = 80 +max-line-length = 88 max-complexity = 16 # B = bugbear # B9 = bugbear opinionated (incl line length) @@ -8,3 +8,5 @@ select = C,E,F,W,B,B9 # E501: flake8 line length (covered by bugbear B950) # W503: line break before binary operator (black behaviour) ignore = E203,E501,W503 +per-file-ignores= + __init__.py:F401 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..10b8acad59 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,46 @@ +name: pre-commit + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + - "14.0-ocabot-*" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + env: + # Consider valid a PR that changes README fragments but doesn't + # change the README.rst file itself. It's not really a problem + # because the bot will update it anyway after merge. This way, we + # lower the barrier for functional contributors that want to fix the + # readme fragments, while still letting developers get README + # auto-generated (which also helps functionals when using runboat). + # DOCS https://pre-commit.com/#temporarily-disabling-hooks + SKIP: oca-gen-addon-readme + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..fa17fcd4e8 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,69 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 12 * * 0" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: Stale PRs and issues policy + uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + # General settings. + ascending: true + remove-stale-when-updated: true + # Pull Requests settings. + # 120+30 day stale policy for PRs + # * Except PRs marked as "no stale" + days-before-pr-stale: 120 + days-before-pr-close: 30 + exempt-pr-labels: "no stale" + stale-pr-label: "stale" + stale-pr-message: > + There hasn't been any activity on this pull request in the past 4 months, so + it has been marked as stale and it will be closed automatically if no + further activity occurs in the next 30 days. + + If you want this PR to never become stale, please ask a PSC member to apply + the "no stale" label. + # Issues settings. + # 180+30 day stale policy for open issues + # * Except Issues marked as "no stale" + days-before-issue-stale: 180 + days-before-issue-close: 30 + exempt-issue-labels: "no stale,needs more information" + stale-issue-label: "stale" + stale-issue-message: > + There hasn't been any activity on this issue in the past 6 months, so it has + been marked as stale and it will be closed automatically if no further + activity occurs in the next 30 days. + + If you want this issue to never become stale, please ask a PSC member to + apply the "no stale" label. + + # 15+30 day stale policy for issues pending more information + # * Issues that are pending more information + # * Except Issues marked as "no stale" + - name: Needs more information stale issues policy + uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + ascending: true + only-labels: "needs more information" + exempt-issue-labels: "no stale" + days-before-stale: 15 + days-before-close: 30 + days-before-pr-stale: -1 + days-before-pr-close: -1 + remove-stale-when-updated: true + stale-issue-label: "stale" + stale-issue-message: > + This issue needs more information and there hasn't been any activity + recently, so it has been marked as stale and it will be closed automatically + if no further activity occurs in the next 30 days. + + If you think this is a mistake, please ask a PSC member to remove the "needs + more information" label. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..c5561694bd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,71 @@ +name: tests + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + - "14.0-ocabot-*" + +jobs: + unreleased-deps: + runs-on: ubuntu-latest + name: Detect unreleased dependencies + steps: + - uses: actions/checkout@v4 + - run: | + for reqfile in requirements.txt test-requirements.txt ; do + if [ -f ${reqfile} ] ; then + result=0 + # reject non-comment lines that contain a / (i.e. URLs, relative paths) + grep "^[^#].*/" ${reqfile} || result=$? + if [ $result -eq 0 ] ; then + echo "Unreleased dependencies found in ${reqfile}." + exit 1 + fi + fi + done + test: + runs-on: ubuntu-22.04 + container: ${{ matrix.container }} + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest + name: test with Odoo + - container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest + name: test with OCB + makepot: "true" + services: + postgres: + image: postgres:9.6 + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install addons and dependencies + run: oca_install_addons + - name: Check licenses + run: manifestoo -d . check-licenses + - name: Check development status + run: manifestoo -d . check-dev-status --default-dev-status=Beta + - name: Initialize test db + run: oca_init_test_database + - name: Run tests + run: oca_run_tests + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Update .pot files + run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} + if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }} diff --git a/.gitignore b/.gitignore index 818770fb1b..6ec07a054b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so @@ -15,7 +16,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ @@ -25,6 +25,19 @@ var/ *.egg *.eggs +# Windows installers +*.msi + +# Debian packages +*.deb + +# Redhat packages +*.rpm + +# MacOS packages +*.dmg +*.pkg + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/.isort.cfg b/.isort.cfg index 7683badfa4..0ec187efd1 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -10,3 +10,4 @@ known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER default_section=THIRDPARTY +ensure_newline_before_comments = True diff --git a/.oca_hooks.cfg b/.oca_hooks.cfg new file mode 100644 index 0000000000..1f3e3e4267 --- /dev/null +++ b/.oca_hooks.cfg @@ -0,0 +1,2 @@ +[MESSAGES_CONTROL] +disable=xml-deprecated-data-node,xml-deprecated-tree-attribute diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b2487c16b..fde55bd12e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,23 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^base_export_async/| - ^base_import_async/| - ^queue_job_cron/| - ^queue_job_subscribe/| - ^test_base_import_async/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| + # We don't want to mess with tool-generated files + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs| # Maybe reactivate this when all README files include prettier ignore tags? ^README\.md$| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # Ignore test files in addons + /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: @@ -30,40 +33,77 @@ repos: entry: found forbidden files; remove them language: fail files: "\\.rej$" + - id: en-po-files + name: en.po files cannot exist + entry: found a en.po file + language: fail + files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 1b5c7ad + rev: d5fab7ee87fceee858a3d01048c78a548974d935 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://github.com/OCA/queue"] + - id: oca-gen-addon-readme + args: + - --addons-dir=. + - --branch=14.0 + - --org-name=OCA + - --repo-name=queue + - --if-source-changed + - --keep-source-digest + - repo: https://github.com/OCA/odoo-pre-commit-hooks + rev: v0.0.25 + hooks: + - id: oca-checks-odoo-module + - id: oca-checks-po + args: + - --disable=po-pretty-format - repo: https://github.com/myint/autoflake - rev: v1.4 + rev: v1.5.3 hooks: - id: autoflake - args: ["-i", "--ignore-init-module-imports"] + args: + - --expand-star-imports + - --ignore-init-module-imports + - --in-place + - --remove-all-unused-imports + - --remove-duplicate-keys + - --remove-unused-variables - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - - repo: https://github.com/prettier/pre-commit - rev: v2.1.2 + - repo: local hooks: - id: prettier - name: prettier + plugin-xml + name: prettier (with plugin-xml) + entry: prettier + args: + - --write + - --list-different + - --ignore-unknown + types: [text] + files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ + language: node additional_dependencies: - "prettier@2.1.2" - "@prettier/plugin-xml@0.12.0" - args: - - --plugin=@prettier/plugin-xml - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v7.8.1 + - repo: local hooks: - id: eslint - verbose: true + name: eslint + entry: eslint args: - --color - --fix + verbose: true + types: [javascript] + language: node + additional_dependencies: + - "eslint@7.8.1" + - "eslint-plugin-jsdoc@" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: @@ -90,8 +130,9 @@ repos: rev: v2.7.2 hooks: - id: pyupgrade + args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.5.1 + rev: 5.12.0 hooks: - id: isort name: isort except __init__.py @@ -99,7 +140,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 2.6.0 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -108,31 +149,21 @@ repos: - requirements.txt - --header - "# generated from manifests external_dependencies" - - repo: https://gitlab.com/PyCQA/flake8 - rev: 3.8.3 + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.0 hooks: - id: flake8 - name: flake8 except __init__.py - exclude: /__init__\.py$ - additional_dependencies: ["flake8-bugbear==20.1.4"] - - id: flake8 - name: flake8 only __init__.py - args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py - files: /__init__\.py$ + name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - - repo: https://github.com/PyCQA/pylint - rev: pylint-2.5.3 + - repo: https://github.com/OCA/pylint-odoo + rev: 7.0.2 hooks: - - id: pylint + - id: pylint_odoo name: pylint with optional checks args: - --rcfile=.pylintrc - --exit-zero verbose: true - additional_dependencies: &pylint_deps - - pylint-odoo==3.5.0 - - id: pylint - name: pylint with mandatory checks + - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory - additional_dependencies: *pylint_deps diff --git a/.pylintrc b/.pylintrc index e33958833e..d1f72970bc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,3 +1,5 @@ + + [MASTER] load-plugins=pylint_odoo score=n diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 08bca3cefe..3bf8ceefbc 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -1,3 +1,4 @@ + [MASTER] load-plugins=pylint_odoo score=n diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4b5ed106df..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: python -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/pre-commit - -python: - - "3.6" - -addons: - postgresql: "9.6" - apt: - packages: - - expect-dev # provides unbuffer utility - -stages: - - linting - - test - -jobs: - include: - - stage: linting - name: "pre-commit" - install: pip install pre-commit - script: pre-commit run --all --show-diff-on-failure --verbose --color always - after_success: - before_install: - - stage: test - env: - - TESTS=1 ODOO_REPO="odoo/odoo" MAKEPOT="1" - - stage: test - env: - - TESTS=1 ODOO_REPO="OCA/OCB" -env: - global: - - VERSION="14.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0" - - MQT_DEP=PIP - -install: - - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git - ${HOME}/maintainer-quality-tools - - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - - travis_install_nightly - -script: - - travis_run_tests - -after_success: - - travis_after_tests_success diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 9ac71fee42..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -# OCA Guidelines - -Please follow the official guide from the -[OCA Guidelines page](https://odoo-community.org/page/contributing). - -## Project Specific Guidelines - - - -This project does not have specific coding guidelines. diff --git a/README.md b/README.md index 22c6c0f3fc..64d6f3cde2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/230/14.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-queue-230) -[![Build Status](https://travis-ci.com/OCA/queue.svg?branch=14.0)](https://travis-ci.com/OCA/queue) + +[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=14.0) +[![Pre-commit Status](https://github.com/OCA/queue/actions/workflows/pre-commit.yml/badge.svg?branch=14.0)](https://github.com/OCA/queue/actions/workflows/pre-commit.yml?query=branch%3A14.0) +[![Build Status](https://github.com/OCA/queue/actions/workflows/test.yml/badge.svg?branch=14.0)](https://github.com/OCA/queue/actions/workflows/test.yml?query=branch%3A14.0) [![codecov](https://codecov.io/gh/OCA/queue/branch/14.0/graph/badge.svg)](https://codecov.io/gh/OCA/queue) [![Translation Status](https://translation.odoo-community.org/widgets/queue-14-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/queue-14-0/?utm_source=widget) @@ -7,7 +9,7 @@ # queue -TODO: add repo description. +Advanced async jobs management for Odoo @@ -17,21 +19,20 @@ TODO: add repo description. Available addons ---------------- -addon | version | summary ---- | --- | --- -[queue_job](queue_job/) | 14.0.1.0.0 | Job Queue -[test_queue_job](test_queue_job/) | 14.0.1.0.0 | Queue Job Tests - - -Unported addons ---------------- -addon | version | summary ---- | --- | --- -[base_export_async](base_export_async/) | 12.0.1.0.0 (unported) | Asynchronous export with job queue -[base_import_async](base_import_async/) | 13.0.2.0.0 (unported) | Import CSV files in the background -[queue_job_cron](queue_job_cron/) | 13.0.2.1.0 (unported) | Scheduled Actions as Queue Jobs -[queue_job_subscribe](queue_job_subscribe/) | 13.0.1.0.0 (unported) | Control which users are subscribed to queue job notifications -[test_base_import_async](test_base_import_async/) | 13.0.1.0.0 (unported) | Test suite for base_import_async. Normally you don't need to install this. +addon | version | maintainers | summary +--- | --- | --- | --- +[base_export_async](base_export_async/) | 14.0.1.1.0 | | Asynchronous export with job queue +[base_import_async](base_import_async/) | 14.0.1.0.2 | | Import CSV files in the background +[export_async_schedule](export_async_schedule/) | 14.0.1.0.1 | guewen | Generate and send exports by emails on a schedule +[queue_job](queue_job/) | 14.0.3.15.1 | guewen | Job Queue +[queue_job_batch](queue_job_batch/) | 14.0.1.0.2 | | Job Queue Batch +[queue_job_context](queue_job_context/) | 14.0.1.0.1 | AshishHirapara | Queue Job, prepare context before enqueue keys +[queue_job_cron](queue_job_cron/) | 14.0.2.0.0 | | Scheduled Actions as Queue Jobs +[queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 14.0.1.0.3 | ivantodorovich | Run jobs without a dedicated JobRunner +[queue_job_subscribe](queue_job_subscribe/) | 14.0.1.0.1 | | Control which users are subscribed to queue job notifications +[test_base_import_async](test_base_import_async/) | 14.0.1.0.1 | | Test suite for base_import_async. Normally you don't need to install this. +[test_queue_job](test_queue_job/) | 14.0.3.5.0 | | Queue Job Tests +[test_queue_job_batch](test_queue_job_batch/) | 14.0.1.0.0 | | Test Job Queue Batch [//]: # (end addons) @@ -41,12 +42,11 @@ addon | version | summary This repository is licensed under [AGPL-3.0](LICENSE). -However, each module can have a totally different license, as long as they adhere to OCA +However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA) policy. Consult each module's `__manifest__.py` file, which contains a `license` key that explains its license. ---- - OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. diff --git a/base_export_async/README.rst b/base_export_async/README.rst index 57652068e6..c4dbfa16ee 100644 --- a/base_export_async/README.rst +++ b/base_export_async/README.rst @@ -1,29 +1,36 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ================= Base Export Async ================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bc288c9ab938e9f909e85e1c7f01148a159a88e617a58de5b0d9766cd949a821 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :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/12.0/base_export_async + :target: https://github.com/OCA/queue/tree/14.0/base_export_async :alt: OCA/queue .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async + :target: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-base_export_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/12.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| Standard Export can be delayed in asynchronous jobs executed in the background and then send by email to the user. @@ -35,8 +42,8 @@ Standard Export can be delayed in asynchronous jobs executed in the background a Usage ===== -The user is presented with a new checkbox "Asynchronous export" -in the export screen. When selected, the export is delayed in a +The user is presented with a new checkbox "Asynchronous export" +in the export screen. When selected, the export is delayed in a background job. The .csv or .xls file generated by the export will be sent by email @@ -47,8 +54,8 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -63,7 +70,8 @@ Authors Contributors ~~~~~~~~~~~~ -Arnaud Pineux (ACSONE SA/NV) authored the initial prototype. +* Arnaud Pineux (ACSONE SA/NV) authored the initial prototype. +* Guewen Baconnier (Camptocamp) Maintainers ~~~~~~~~~~~ @@ -78,6 +86,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 `_ project on GitHub. +This module is part of the `OCA/queue `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_export_async/__manifest__.py b/base_export_async/__manifest__.py index a39844c499..3a6c944759 100644 --- a/base_export_async/__manifest__.py +++ b/base_export_async/__manifest__.py @@ -3,10 +3,8 @@ { "name": "Base Export Async", - "summary": """ - Asynchronous export with job queue - """, - "version": "12.0.1.0.0", + "summary": "Asynchronous export with job queue", + "version": "14.0.1.1.0", "license": "AGPL-3", "author": "ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", @@ -17,8 +15,9 @@ "security/ir_rule.xml", "data/config_parameter.xml", "data/cron.xml", + "data/mail_template.xml", ], "demo": [], "qweb": ["static/src/xml/base.xml"], - "installable": False, + "installable": True, } diff --git a/base_export_async/data/config_parameter.xml b/base_export_async/data/config_parameter.xml index e3c1e5e35e..38ff75fd6e 100644 --- a/base_export_async/data/config_parameter.xml +++ b/base_export_async/data/config_parameter.xml @@ -1,4 +1,4 @@ - + attachment.ttl diff --git a/base_export_async/data/cron.xml b/base_export_async/data/cron.xml index ba42369ac3..7e12c92a02 100644 --- a/base_export_async/data/cron.xml +++ b/base_export_async/data/cron.xml @@ -1,8 +1,8 @@ - + Delete Generated Exports - + code model.cron_delete() 1 diff --git a/base_export_async/data/mail_template.xml b/base_export_async/data/mail_template.xml new file mode 100644 index 0000000000..e1f8904e8b --- /dev/null +++ b/base_export_async/data/mail_template.xml @@ -0,0 +1,19 @@ + + + + Delay Export + Export ${object.model_description} ${datetime.date.today()} + + + +

Your export is available here.

+

It will be automatically deleted the ${object.expiration_date}.

+
+

This is an automated message please do not reply.

+
+
+
diff --git a/base_export_async/i18n/base_export_async.pot b/base_export_async/i18n/base_export_async.pot index 3f450bb117..9ad8606e20 100644 --- a/base_export_async/i18n/base_export_async.pot +++ b/base_export_async/i18n/base_export_async.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_export_async +# * base_export_async # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,33 +14,30 @@ msgstr "" "Plural-Forms: \n" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:112 +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format -msgid "\n" -"

Your export is available here.

\n" -"

It will be automatically deleted the {}.

\n" -"

 

\n" -"

\n" -" This is an automated message please do not reply.\n" -"

\n" -" " +msgid "(You will receive the export by email)" msgstr "" #. module: base_export_async -#. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 -#, python-format -msgid "(You will receive the export by email)" +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object.expiration_date}.

\n" +"
\n" +"

This is an automated message please do not reply.

\n" +" " msgstr "" #. module: base_export_async #: model:ir.model,name:base_export_async.model_delay_export -msgid "Allow to delay the export" +msgid "Asynchronous Export" msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format msgid "Asynchronous export" msgstr "" @@ -68,14 +65,18 @@ msgid "Display Name" msgstr "" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:110 -#, python-format -msgid "Export {} {}" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:47 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "External ID" msgstr "" @@ -100,34 +101,37 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:39 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "Please select fields to export..." msgstr "" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:42 -#, python-format -msgid "The user doesn't have an email address." +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" msgstr "" #. module: base_export_async -#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_id -msgid "User" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" msgstr "" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:29 +#: code:addons/base_export_async/models/delay_export.py:0 #, python-format msgid "You must set an email address to your user." msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:91 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "You will receive the export file by email as soon as it is finished." msgstr "" - diff --git a/base_export_async/i18n/da.po b/base_export_async/i18n/da.po new file mode 100644 index 0000000000..a3a0d7f01b --- /dev/null +++ b/base_export_async/i18n/da.po @@ -0,0 +1,167 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_export_async +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-02-07 17:45+0000\n" +"Last-Translator: Hans Henrik Gabelgaard \n" +"Language-Team: none\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "(You will receive the export by email)" +msgstr "(Du vil modtage eksporten via mail)" + +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" + +#. module: base_export_async +#: model:ir.model,name:base_export_async.model_delay_export +msgid "Asynchronous Export" +msgstr "Asynkron export" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "Asynchronous export" +msgstr "Asynkron export" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_uid +msgid "Created by" +msgstr "Oprettet af" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_date +msgid "Created on" +msgstr "Oprettet den" + +#. module: base_export_async +#: model:ir.actions.server,name:base_export_async.to_delete_attachment_ir_actions_server +#: model:ir.cron,cron_name:base_export_async.to_delete_attachment +#: model:ir.cron,name:base_export_async.to_delete_attachment +msgid "Delete Generated Exports" +msgstr "Slet genererede eksporter" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__display_name +msgid "Display Name" +msgstr "Vist navn" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "External ID" +msgstr "External ID" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__id +msgid "ID" +msgstr "ID" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export____last_update +msgid "Last Modified on" +msgstr "Senest rettet den" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_uid +msgid "Last Updated by" +msgstr "Senest rettet af" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_date +msgid "Last Updated on" +msgstr "Senest rettet den" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "Please select fields to export..." +msgstr "Vælg venligst felter til eksporten..." + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" +msgstr "Brugere" + +#. module: base_export_async +#: code:addons/base_export_async/models/delay_export.py:0 +#, python-format +msgid "You must set an email address to your user." +msgstr "Du skal have en email adresse på dit brugeropsæt." + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "You will receive the export file by email as soon as it is finished." +msgstr "Du vil modtage et link til eksporten så snart den er færdig." + +#, python-format +#~ msgid "" +#~ "\n" +#~ "

Your export is available here.

\n" +#~ "

It will be automatically deleted the {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " This is an automated message please do not reply.\n" +#~ "

\n" +#~ " " +#~ msgstr "" +#~ "\n" +#~ "

Din export er tilgængelig her.

\n" +#~ "

Den vil atutomatisk blive slettet den {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " Dette er en automatisk besked. Undlad venlisgt at " +#~ "besvare.\n" +#~ "

\n" +#~ " " + +#, python-format +#~ msgid "Export {} {}" +#~ msgstr "Eksport {} {}" diff --git a/base_export_async/i18n/de.po b/base_export_async/i18n/de.po index 72d0bdfbc3..1d6505f262 100644 --- a/base_export_async/i18n/de.po +++ b/base_export_async/i18n/de.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_export_async +# * base_export_async # msgid "" msgstr "" @@ -16,43 +16,34 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 3.7.1\n" -#. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:112 -#, python-format -msgid "\n" -"

Your export is available here.

\n" -"

It will be automatically deleted the {}.

\n" -"

 

\n" -"

\n" -" This is an automated message please do not reply.\n" -"

\n" -" " -msgstr "" -"\n" -"

Der Export ist hier verfügbar.

\n" -"

Das {} wird automatisch gelöscht.

\n" -"

 

\n" -"

\n" -" Dies ist eine automatisch erstellte Nachricht, bitte nicht " -"darauf antworten.\n" -"

\n" -" " - #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format msgid "(You will receive the export by email)" msgstr "(Der Export wird per Mail bereitgestellt.)" +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" + #. module: base_export_async #: model:ir.model,name:base_export_async.model_delay_export -msgid "Allow to delay the export" -msgstr "Verzögerung des Exports erlauben" +#, fuzzy +msgid "Asynchronous Export" +msgstr "Asynchroner Export" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format msgid "Asynchronous export" msgstr "Asynchroner Export" @@ -80,14 +71,18 @@ msgid "Display Name" msgstr "Anzeigename" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:110 -#, python-format -msgid "Export {} {}" -msgstr "Export {} {}" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:47 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "External ID" msgstr "Externe ID" @@ -112,26 +107,30 @@ msgstr "Zuletzt aktualisiert von" msgid "Last Updated on" msgstr "Zuletzt aktualisiert am" +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:39 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "Please select fields to export..." msgstr "Bitte Felder für den Export auswählen..." #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:42 -#, python-format -msgid "The user doesn't have an email address." -msgstr "Der Benutzer hat keine Email-Adresse." +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "" #. module: base_export_async -#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_id -msgid "User" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" msgstr "Benutzer" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:29 +#: code:addons/base_export_async/models/delay_export.py:0 #, python-format msgid "You must set an email address to your user." msgstr "" @@ -139,8 +138,39 @@ msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:91 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "You will receive the export file by email as soon as it is finished." msgstr "" "Die Export-Datei wird per Email versendet, sobald der Export beendet ist." + +#, python-format +#~ msgid "" +#~ "\n" +#~ "

Your export is available here.

\n" +#~ "

It will be automatically deleted the {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " This is an automated message please do not reply.\n" +#~ "

\n" +#~ " " +#~ msgstr "" +#~ "\n" +#~ "

Der Export ist hier verfügbar.

\n" +#~ "

Das {} wird automatisch gelöscht.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " Dies ist eine automatisch erstellte Nachricht, bitte " +#~ "nicht darauf antworten.\n" +#~ "

\n" +#~ " " + +#, python-format +#~ msgid "Export {} {}" +#~ msgstr "Export {} {}" + +#~ msgid "Allow to delay the export" +#~ msgstr "Verzögerung des Exports erlauben" + +#~ msgid "The user doesn't have an email address." +#~ msgstr "Der Benutzer hat keine Email-Adresse." diff --git a/base_export_async/i18n/fr.po b/base_export_async/i18n/fr.po new file mode 100644 index 0000000000..9bc60621b7 --- /dev/null +++ b/base_export_async/i18n/fr.po @@ -0,0 +1,168 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_export_async +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-11-20 16:54+0000\n" +"Last-Translator: Yann Papouin \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "(You will receive the export by email)" +msgstr "(Vous recevrez cet export par courriel)" + +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" + +#. module: base_export_async +#: model:ir.model,name:base_export_async.model_delay_export +msgid "Asynchronous Export" +msgstr "Export asynchrone" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "Asynchronous export" +msgstr "Export asynchrone" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: base_export_async +#: model:ir.actions.server,name:base_export_async.to_delete_attachment_ir_actions_server +#: model:ir.cron,cron_name:base_export_async.to_delete_attachment +#: model:ir.cron,name:base_export_async.to_delete_attachment +msgid "Delete Generated Exports" +msgstr "Supprimer les exports générés" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "External ID" +msgstr "Identifiant externe" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__id +msgid "ID" +msgstr "ID" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "Please select fields to export..." +msgstr "Veuillez choisir les champs à exporter..." + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" +msgstr "Utilisateurs" + +#. module: base_export_async +#: code:addons/base_export_async/models/delay_export.py:0 +#, python-format +msgid "You must set an email address to your user." +msgstr "Vous devez définir une adresse e-mail pour votre utilisateur." + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "You will receive the export file by email as soon as it is finished." +msgstr "Vous recevrez le fichier d'export par courriel dès qu'il sera terminé." + +#, python-format +#~ msgid "" +#~ "\n" +#~ "

Your export is available here.

\n" +#~ "

It will be automatically deleted the {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " This is an automated message please do not reply.\n" +#~ "

\n" +#~ " " +#~ msgstr "" +#~ "\n" +#~ "

Votre export est disponible ici.\n" +#~ "

Il sera automatiquement supprimé le {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " Ceci est un message automatisé, merci de ne pas " +#~ "répondre.\n" +#~ "

\n" +#~ " " + +#, python-format +#~ msgid "Export {} {}" +#~ msgstr "Export {} {}" diff --git a/base_export_async/i18n/it.po b/base_export_async/i18n/it.po new file mode 100644 index 0000000000..2283e06398 --- /dev/null +++ b/base_export_async/i18n/it.po @@ -0,0 +1,150 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_export_async +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-01-16 16:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "(You will receive the export by email)" +msgstr "(Verrà inviata l'esportazione vie e-mail)" + +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" +"

La tua esportazione è disponibile here.

" +"\n" +"

Verrà eliminata automaticamente il ${object." +"expiration_date}.

\n" +"
\n" +"

Questo è un messaggio " +"automatico, non rispondere.

\n" +" " + +#. module: base_export_async +#: model:ir.model,name:base_export_async.model_delay_export +msgid "Asynchronous Export" +msgstr "Esportazione asincrona" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "Asynchronous export" +msgstr "Esportazione asincrona" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: base_export_async +#: model:ir.actions.server,name:base_export_async.to_delete_attachment_ir_actions_server +#: model:ir.cron,cron_name:base_export_async.to_delete_attachment +#: model:ir.cron,name:base_export_async.to_delete_attachment +msgid "Delete Generated Exports" +msgstr "Cancella esportazioni generate" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "Data di scadenza" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "Esportazione ${object.model_description} ${datetime.date.today()}" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "External ID" +msgstr "ID esterno" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__id +msgid "ID" +msgstr "ID" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "Descrizione modello" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "Please select fields to export..." +msgstr "Selezionare i campi da esportare..." + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "URL" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" +msgstr "Utenti" + +#. module: base_export_async +#: code:addons/base_export_async/models/delay_export.py:0 +#, python-format +msgid "You must set an email address to your user." +msgstr "Bisogna impostare una e-mail nel proprio utente." + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "You will receive the export file by email as soon as it is finished." +msgstr "Verrà inviato via e-mail il file esportazione appena sarà completato." diff --git a/base_export_async/i18n/pt.po b/base_export_async/i18n/pt.po new file mode 100644 index 0000000000..88ab925247 --- /dev/null +++ b/base_export_async/i18n/pt.po @@ -0,0 +1,168 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_export_async +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-04 16:45+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "(You will receive the export by email)" +msgstr "(Receberá a exportação por email)" + +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" + +#. module: base_export_async +#: model:ir.model,name:base_export_async.model_delay_export +msgid "Asynchronous Export" +msgstr "Exportação Assíncrona" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/xml/base.xml:0 +#, python-format +msgid "Asynchronous export" +msgstr "Exportação assíncrona" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_uid +msgid "Created by" +msgstr "Criada por" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__create_date +msgid "Created on" +msgstr "Criado em" + +#. module: base_export_async +#: model:ir.actions.server,name:base_export_async.to_delete_attachment_ir_actions_server +#: model:ir.cron,cron_name:base_export_async.to_delete_attachment +#: model:ir.cron,name:base_export_async.to_delete_attachment +msgid "Delete Generated Exports" +msgstr "Eliminar Exportações Geradas" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__display_name +msgid "Display Name" +msgstr "Nome a Apresentar" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "External ID" +msgstr "ID Externo" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__id +msgid "ID" +msgstr "" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export____last_update +msgid "Last Modified on" +msgstr "Última Modificação em" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_uid +msgid "Last Updated by" +msgstr "Última Atualização por" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__write_date +msgid "Last Updated on" +msgstr "Última Atualização em" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "Please select fields to export..." +msgstr "Por favor, selecione os campos a exportar..." + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "" + +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" +msgstr "Utilizadores" + +#. module: base_export_async +#: code:addons/base_export_async/models/delay_export.py:0 +#, python-format +msgid "You must set an email address to your user." +msgstr "Tem que atribuir um email ao seu utilizador." + +#. module: base_export_async +#. openerp-web +#: code:addons/base_export_async/static/src/js/data_export.js:0 +#, python-format +msgid "You will receive the export file by email as soon as it is finished." +msgstr "" +"Receberá o ficheiro de exportação por email assim que este estiver terminado." + +#, python-format +#~ msgid "" +#~ "\n" +#~ "

Your export is available here.

\n" +#~ "

It will be automatically deleted the {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " This is an automated message please do not reply.\n" +#~ "

\n" +#~ " " +#~ msgstr "" +#~ "\n" +#~ "

A sua exportação está disponível aqui.

\n" +#~ "

Será automaticamente eliminada em {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " Esta é uma mensagem automática. Por favor, não responda.\n" +#~ "

\n" +#~ " " + +#, python-format +#~ msgid "Export {} {}" +#~ msgstr "Exportar {} {}" diff --git a/base_export_async/i18n/zh_CN.po b/base_export_async/i18n/zh_CN.po index 356e6aac6a..43c7ece307 100644 --- a/base_export_async/i18n/zh_CN.po +++ b/base_export_async/i18n/zh_CN.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_export_async +# * base_export_async # msgid "" msgstr "" @@ -16,42 +16,34 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.7.1\n" -#. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:112 -#, python-format -msgid "\n" -"

Your export is available here.

\n" -"

It will be automatically deleted the {}.

\n" -"

 

\n" -"

\n" -" This is an automated message please do not reply.\n" -"

\n" -" " -msgstr "" -"\n" -"

你的导出可以用 这里.

\n" -"

它将自动删除 {}。

\n" -"

 

\n" -"

\n" -" 这是一条自动消息,请不要回复。\n" -"

\n" -" " - #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format msgid "(You will receive the export by email)" msgstr "(您将通过电子邮件收到导出)" +#. module: base_export_async +#: model:mail.template,body_html:base_export_async.delay_export_mail_template +msgid "" +"

Your export is available here.

\n" +"

It will be automatically deleted the ${object." +"expiration_date}.

\n" +"
\n" +"

This is an automated message " +"please do not reply.

\n" +" " +msgstr "" + #. module: base_export_async #: model:ir.model,name:base_export_async.model_delay_export -msgid "Allow to delay the export" -msgstr "允许延迟导出" +#, fuzzy +msgid "Asynchronous Export" +msgstr "异步导出" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/xml/base.xml:9 +#: code:addons/base_export_async/static/src/xml/base.xml:0 #, python-format msgid "Asynchronous export" msgstr "异步导出" @@ -79,14 +71,18 @@ msgid "Display Name" msgstr "显示名称" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:110 -#, python-format -msgid "Export {} {}" -msgstr "导出{} {}" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__expiration_date +msgid "Expiration Date" +msgstr "" + +#. module: base_export_async +#: model:mail.template,subject:base_export_async.delay_export_mail_template +msgid "Export ${object.model_description} ${datetime.date.today()}" +msgstr "" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:47 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "External ID" msgstr "外部ID" @@ -111,33 +107,67 @@ msgstr "最后更新者" msgid "Last Updated on" msgstr "最后更新时间" +#. module: base_export_async +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__model_description +msgid "Model Description" +msgstr "" + #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:39 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "Please select fields to export..." msgstr "请选择要导出的字段..." #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:42 -#, python-format -msgid "The user doesn't have an email address." -msgstr "用户没有电子邮件地址。" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__url +msgid "Url" +msgstr "" #. module: base_export_async -#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_id -msgid "User" +#: model:ir.model.fields,field_description:base_export_async.field_delay_export__user_ids +msgid "Users" msgstr "用户" #. module: base_export_async -#: code:addons/base_export_async/models/delay_export.py:29 +#: code:addons/base_export_async/models/delay_export.py:0 #, python-format msgid "You must set an email address to your user." msgstr "您必须为您的用户设置电子邮件地址。" #. module: base_export_async #. openerp-web -#: code:addons/base_export_async/static/src/js/data_export.js:91 +#: code:addons/base_export_async/static/src/js/data_export.js:0 #, python-format msgid "You will receive the export file by email as soon as it is finished." msgstr "完成后,您将通过电子邮件收到导出文件。" + +#, python-format +#~ msgid "" +#~ "\n" +#~ "

Your export is available here.

\n" +#~ "

It will be automatically deleted the {}.

\n" +#~ "

 

\n" +#~ "

\n" +#~ " This is an automated message please do not reply.\n" +#~ "

\n" +#~ " " +#~ msgstr "" +#~ "\n" +#~ "

你的导出可以用 这里.

\n" +#~ "

它将自动删除 {}。

\n" +#~ "

 

\n" +#~ "

\n" +#~ " 这是一条自动消息,请不要回复。\n" +#~ "

\n" +#~ " " + +#, python-format +#~ msgid "Export {} {}" +#~ msgstr "导出{} {}" + +#~ msgid "Allow to delay the export" +#~ msgstr "允许延迟导出" + +#~ msgid "The user doesn't have an email address." +#~ msgstr "用户没有电子邮件地址。" diff --git a/base_export_async/models/delay_export.py b/base_export_async/models/delay_export.py index 7881af001b..4f83ed1c0b 100644 --- a/base_export_async/models/delay_export.py +++ b/base_export_async/models/delay_export.py @@ -3,27 +3,29 @@ import base64 import json -import logging import operator from dateutil.relativedelta import relativedelta + from odoo import _, api, fields, models -from odoo.addons.queue_job.job import job -from odoo.addons.web.controllers.main import CSVExport, ExcelExport from odoo.exceptions import UserError -_logger = logging.getLogger(__name__) +from odoo.addons.web.controllers.main import CSVExport, ExcelExport class DelayExport(models.Model): _name = "delay.export" - _description = "Allow to delay the export" + _description = "Asynchronous Export" - user_id = fields.Many2one("res.users", string="User", index=True) + user_ids = fields.Many2many("res.users", string="Users", index=True) + model_description = fields.Char() + url = fields.Char() + expiration_date = fields.Date() @api.model def delay_export(self, data): + """Delay the export, called from js""" params = json.loads(data.get("data")) if not self.env.user.email: raise UserError(_("You must set an email address to your user.")) @@ -32,14 +34,11 @@ def delay_export(self, data): @api.model def _get_file_content(self, params): export_format = params.get("format") - raw_data = export_format != "csv" - item_names = ("model", "fields", "ids", "domain", "import_compat", "context") - items = operator.itemgetter(item_names)(params) - model_name, fields_name, ids, domain, import_compat, context = items - user = self.env["res.users"].browse([context.get("uid")]) - if not user or not user.email: - raise UserError(_("The user doesn't have an email address.")) + items = operator.itemgetter( + "model", "fields", "ids", "domain", "import_compat", "context", "user_ids" + )(params) + (model_name, fields_name, ids, domain, import_compat, context, user_ids) = items model = self.env[model_name].with_context( import_compat=import_compat, **context @@ -52,7 +51,7 @@ def _get_file_content(self, params): fields_name = [field for field in fields_name if field["name"] != "id"] field_names = [f["name"] for f in fields_name] - import_data = records.export_data(field_names, raw_data).get("datas", []) + import_data = records.export_data(field_names).get("datas", []) if import_compat: columns_headers = field_names @@ -67,23 +66,34 @@ def _get_file_content(self, params): return xls.from_data(columns_headers, import_data) @api.model - @job def export(self, params): + """Delayed export of a file sent by email + + The ``params`` is a dict of parameters, contains: + + * format: csv/excel + * model: model to export + * fields: list of fields to export, a list of dict: + [{'label': '', 'name': ''}] + * ids: list of ids to export + * domain: domain for the export + * context: context for the export (language, ...) + * import_compat: if the export is export/import compatible (boolean) + * user_ids: optional list of user ids who receive the file + """ content = self._get_file_content(params) - model_name, context, export_format = operator.itemgetter( - "model", "context", "format" - )(params) - user = self.env["res.users"].browse([context.get("uid")]) + items = operator.itemgetter("model", "context", "format", "user_ids")(params) + model_name, context, export_format, user_ids = items + users = self.env["res.users"].browse(user_ids) - export_record = self.sudo().create({"user_id": user.id}) + export_record = self.sudo().create({"user_ids": [(6, 0, users.ids)]}) name = "{}.{}".format(model_name, export_format) attachment = self.env["ir.attachment"].create( { "name": name, "datas": base64.b64encode(content), - "datas_fname": name, "type": "binary", "res_model": self._name, "res_id": export_record.id, @@ -96,6 +106,10 @@ def export(self, params): attachment.name, ) + if any(user.has_group("base.group_portal") for user in users): + attachment.generate_access_token() + url += f"&access_token={attachment.access_token}" + time_to_live = ( self.env["ir.config_parameter"].sudo().get_param("attachment.ttl", 7) ) @@ -104,30 +118,24 @@ def export(self, params): date_today + relativedelta(days=+int(time_to_live)) ) - # TODO : move to email template odoo_bot = self.sudo().env.ref("base.partner_root") email_from = odoo_bot.email model_description = self.env[model_name]._description - self.env["mail.mail"].create( + export_record.write( { + "url": url, + "expiration_date": expiration_date, + "model_description": model_description, + } + ) + + self.env.ref("base_export_async.delay_export_mail_template").send_mail( + export_record.id, + email_values={ "email_from": email_from, "reply_to": email_from, - "email_to": user.email, - "subject": _("Export {} {}").format( - model_description, fields.Date.to_string(fields.Date.today()) - ), - "body_html": _( - """ -

Your export is available here.

-

It will be automatically deleted the {}.

-

 

-

- This is an automated message please do not reply. -

- """ - ).format(url, expiration_date), - "auto_delete": True, - } + "recipient_ids": [(6, 0, users.mapped("partner_id").ids)], + }, ) @api.model diff --git a/base_export_async/readme/CONTRIBUTORS.rst b/base_export_async/readme/CONTRIBUTORS.rst index ede63fcc0d..b1a90f9127 100644 --- a/base_export_async/readme/CONTRIBUTORS.rst +++ b/base_export_async/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ -Arnaud Pineux (ACSONE SA/NV) authored the initial prototype. +* Arnaud Pineux (ACSONE SA/NV) authored the initial prototype. +* Guewen Baconnier (Camptocamp) diff --git a/base_export_async/security/ir_rule.xml b/base_export_async/security/ir_rule.xml index 7ed488ed37..d7934f09ae 100644 --- a/base_export_async/security/ir_rule.xml +++ b/base_export_async/security/ir_rule.xml @@ -1,13 +1,13 @@ - - + + Only user can read delay.export - - - - - - - [('user_id', '=', user.id)] + + + + + + + [('user_ids', 'in', user.id)] diff --git a/base_export_async/static/description/index.html b/base_export_async/static/description/index.html index 7620c7e958..a392bd01b6 100644 --- a/base_export_async/static/description/index.html +++ b/base_export_async/static/description/index.html @@ -1,20 +1,20 @@ - - -Base Export Async + +README.rst -
-

Base Export Async

+
+ + +Odoo Community Association + +
+

Base Export Async

-

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

Standard Export can be delayed in asynchronous jobs executed in the background and then send by email to the user.

Table of contents

-

Usage

+

Usage

The user is presented with a new checkbox “Asynchronous export” in the export screen. When selected, the export is delayed in a background job.

@@ -391,36 +398,42 @@

Usage

to the user who execute the export.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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.

+If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
-

Contributors

-

Arnaud Pineux (ACSONE SA/NV) authored the initial prototype.

+

Contributors

+
    +
  • Arnaud Pineux (ACSONE SA/NV) authored the initial prototype.
  • +
  • Guewen Baconnier (Camptocamp)
  • +
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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 project on GitHub.

+

This module is part of the OCA/queue project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
diff --git a/base_export_async/static/src/js/data_export.js b/base_export_async/static/src/js/data_export.js index 06a7af02a0..29f4aea6c5 100644 --- a/base_export_async/static/src/js/data_export.js +++ b/base_export_async/static/src/js/data_export.js @@ -1,11 +1,11 @@ -odoo.define('base_export_async.DataExport', function(require) { +odoo.define("base_export_async.DataExport", function (require) { "use strict"; - var core = require('web.core'); - var DataExport = require('web.DataExport'); - var framework = require('web.framework'); - var pyUtils = require('web.py_utils'); - var Dialog = require('web.Dialog'); + var core = require("web.core"); + var DataExport = require("web.DataExport"); + var framework = require("web.framework"); + var pyUtils = require("web.py_utils"); + var Dialog = require("web.Dialog"); var _t = core._t; DataExport.include({ @@ -14,83 +14,54 @@ odoo.define('base_export_async.DataExport', function(require) { A flag (checkbox) Async is added and if checked, call the delay export instead of the standard export. */ - start: function() { + start: function () { this._super.apply(this, arguments); - this.async = this.$('#async_export'); + this.async = this.$("#async_export"); }, - export_data: function() { - var self = this; - if (self.async.is(":checked")) { + _exportData(exportedFields, exportFormat, idsToExport) { + if (this.async && this.async.is(":checked")) { /* Checks from the standard method */ - var exported_fields = this.$( - '.o_fields_list option').map( - function() { - return { - name: (self.records[this.value] || - this).value, - label: this.textContent || - this.innerText - }; - }).get(); - - if (_.isEmpty(exported_fields)) { - Dialog.alert(this, _t( - "Please select fields to export..." - )); + if (_.isEmpty(exportedFields)) { + Dialog.alert(this, _t("Please select fields to export...")); return; } - if (!this.isCompatibleMode) { - exported_fields.unshift({ - name: 'id', - label: _t('External ID') - }); + if (this.isCompatibleMode) { + exportedFields.unshift({name: "id", label: _t("External ID")}); } - var export_format = this.$export_format_inputs - .filter(':checked').val(); - /* Call the delay export if Async is checked */ framework.blockUI(); this._rpc({ - model: 'delay.export', - method: 'delay_export', - args: [{ - data: JSON.stringify({ - format: export_format, - model: this - .record - .model, - fields: exported_fields, - ids: this - .ids_to_export, - domain: this - .domain, - context: pyUtils - .eval( - 'contexts', [ - this - .record - .getContext() - ] - ), - import_compat: - !! - this - .$import_compat_radios - .filter( - ':checked' - ).val(), - }) - }], - }).then(function(result) { + model: "delay.export", + method: "delay_export", + args: [ + { + data: JSON.stringify({ + format: exportFormat, + model: this.record.model, + fields: exportedFields, + ids: idsToExport, + domain: this.domain, + context: pyUtils.eval("contexts", [ + this.record.getContext(), + ]), + import_compat: this.isCompatibleMode, + user_ids: [this.record.context.uid], + }), + }, + ], + }).then(function () { framework.unblockUI(); - Dialog.alert(this, _t( - "You will receive the export file by email as soon as it is finished." - )); + Dialog.alert( + this, + _t( + "You will receive the export file by email as soon as it is finished." + ) + ); }); } else { /* diff --git a/base_export_async/static/src/xml/base.xml b/base_export_async/static/src/xml/base.xml index 24f53a000f..97b04cfeb1 100644 --- a/base_export_async/static/src/xml/base.xml +++ b/base_export_async/static/src/xml/base.xml @@ -1,12 +1,18 @@ - + - -
-