diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 000000000..732f2bc02 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,25 @@ +# Do NOT update manually; changes here will be overwritten by Copier +_commit: v1.16.1 +_src_path: https://github.com/OCA/oca-addons-repo-template.git +ci: GitHub +dependency_installation_mode: PIP +generate_requirements_txt: true +github_check_license: false +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: OCB +odoo_version: 12.0 +org_name: Odoo Community Association (OCA) +org_slug: OCA +rebel_module_groups: [] +repo_description: Document Management System +repo_name: DMS for Odoo +repo_slug: dms +repo_website: https://github.com/OCA/dms +travis_apt_packages: [] +travis_apt_sources: [] + diff --git a/.flake8 b/.flake8 index 44ed868f7..6363964b5 100644 --- a/.flake8 +++ b/.flake8 @@ -1,10 +1,11 @@ [flake8] -max-line-length = 80 -max-complexity = 16 -# B = bugbear -# B9 = bugbear opinionated (incl line length) -select = C,E,F,W,B,B9 -# E203: whitespace before ':' (black behaviour) -# E501: flake8 line length (covered by bugbear B950) -# W503: line break before binary operator (black behaviour) -ignore = E203,E501,W503 +# E123,E133,E226,E241,E242 are ignored by default by pep8 and flake8 +# F811 is legal in odoo 8 when we implement 2 interfaces for a method +# F601 pylint support this case with expected tests +# W503 changed by W504 and OCA prefers allow both +# E203: whitespace before ':' (black behaviour and not pep8 compliant) +ignore = E123,E133,E226,E241,E242,F811,F601,W503,W504,E203 +max-line-length = 88 +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 000000000..6d54b60f4 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,37 @@ +name: pre-commit + +on: + pull_request: + branches: + - "12.0*" + push: + branches: + - "12.0" + - "12.0-ocabot-*" + +jobs: + pre-commit: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.6" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + 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 + - 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 000000000..1693a1253 --- /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@v4 + 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@v4 + 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 000000000..a713d9975 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,68 @@ +name: tests + +on: + pull_request: + branches: + - "12.0*" + push: + branches: + - "12.0" + - "12.0-ocabot-*" + +jobs: + unreleased-deps: + runs-on: ubuntu-latest + name: Detect unreleased dependencies + steps: + - uses: actions/checkout@v3 + - 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-20.04 + container: ${{ matrix.container }} + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - container: ghcr.io/oca/oca-ci/py3.6-ocb12.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@v3 + with: + persist-credentials: false + - name: Install addons and dependencies + run: oca_install_addons + - name: Check licenses + run: manifestoo -d . check-licenses + continue-on-error: true + - 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@v1 + - 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 818770fb1..9c283fd41 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7624b35df..483031fe5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | # 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$| + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| # Maybe reactivate this when all README files include prettier ignore tags? ^README\.md$| # Library files can have extraneous formatting (even minimized) @@ -15,18 +15,8 @@ exclude: | # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: - python: python3 - node: "14.13.0" + python: python3.6 repos: - - repo: local - hooks: - # These files are most likely copier diff rejection junks; if found, - # review them manually, fix the problem (if needed) and remove them - - id: forbidden-files - name: forbidden files - entry: found forbidden files; remove them - language: fail - files: "\\.rej$" - repo: https://github.com/oca/maintainer-tools rev: ab1d7f6 hooks: @@ -34,81 +24,22 @@ repos: - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://github.com/OCA/dms"] - - repo: https://github.com/myint/autoflake - rev: v1.4 - hooks: - - id: autoflake - args: ["-i", "--ignore-init-module-imports"] - - repo: https://github.com/psf/black - rev: 19.10b0 - hooks: - - id: black - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v1.19.1 - hooks: - - id: prettier - - id: prettier - name: prettier xml plugin - additional_dependencies: - - "prettier@1.19.1" - - "@prettier/plugin-xml@0.7.2" - files: \.xml$ - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v6.8.0 - hooks: - - id: eslint - verbose: true - args: - - --color - - --fix - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 - hooks: - - id: trailing-whitespace - # exclude autogenerated files - exclude: /README\.rst$|\.pot?$ - - id: end-of-file-fixer - # exclude autogenerated files - exclude: /README\.rst$|\.pot?$ - - id: debug-statements - - id: fix-encoding-pragma - args: ["--remove"] - - id: check-case-conflict - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-merge-conflict - # exclude files where underlines are not distinguishable from merge conflicts - exclude: /README\.rst$|^docs/.*\.rst$ - - id: check-symlinks - - id: check-xml - - id: mixed-line-ending - args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v1.26.2 - hooks: - - id: pyupgrade - - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.21 - hooks: - - id: isort - name: isort except __init__.py - exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 2.5.2 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 + - id: setuptools-odoo-get-requirements + args: + - --output + - requirements.txt + - --header + - "# generated from manifests external_dependencies" + - repo: https://github.com/OCA/mirrors-flake8 + rev: v3.4.1 hooks: - id: flake8 - name: flake8 except __init__.py - exclude: /__init__\.py$ - additional_dependencies: ["flake8-bugbear==19.8.0"] - - id: flake8 - name: flake8 only __init__.py - args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py - files: /__init__\.py$ - additional_dependencies: ["flake8-bugbear==19.8.0"] + name: flake8 excluding __init__.py + exclude: __init__\.py - repo: https://github.com/pre-commit/mirrors-pylint rev: v2.5.3 hooks: @@ -125,3 +56,4 @@ repos: args: - --rcfile=.pylintrc-mandatory additional_dependencies: *pylint_deps + diff --git a/.pylintrc b/.pylintrc index 9e34abde3..d8abd7129 100644 --- a/.pylintrc +++ b/.pylintrc @@ -13,6 +13,25 @@ valid_odoo_versions=12.0 [MESSAGES CONTROL] disable=all +# Enable message and code: +# anomalous-backslash-in-string - W1401 +# assignment-from-none - W1111 +# dangerous-default-value - W0102 +# duplicate-key - W0109 +# missing-import-error - W7935 +# missing-manifest-dependency - W7936 +# pointless-statement - W0104 +# pointless-string-statement - W0105 +# print-statement - E1601 +# redundant-keyword-arg - E1124 +# reimported - W0404 +# relative-import - W0403 +# return-in-init - E0101 +# rst-syntax-error - E7901 +# too-few-format-args - E1306 +# unreachable - W0101 + + # This .pylintrc contains optional AND mandatory checks and is meant to be # loaded in an IDE to have it check everything, in the hope this will make # optional checks more visible to contributors who otherwise never look at a @@ -20,68 +39,118 @@ disable=all # .pylintrc-mandatory containing only mandatory checks is used the pre-commit # config as a blocking check. +# Beta message and code: +# api-one-deprecated - W8104 +# api-one-multi-together - W8101 +# attribute-deprecated - W8105 +# class-camelcase - C8104 +# create-user-wo-reset-password - W7905 +# consider-merging-classes-inherited - R7980 +# copy-wo-api-one - W8102 +# dangerous-filter-wo-user - W7901 +# dangerous-view-replace-wo-priority - W7940 +# deprecated-module - W0402 +# duplicate-id-csv - W7906 +# duplicate-xml-fields - W7907 +# duplicate-xml-record-id - W7902 +# file-not-used - W7930 +# incoherent-interpreter-exec-perm - W8201 +# invalid-commit - E8102 +# javascript-lint - W7903 +# manifest-deprecated-key - C8103 +# method-compute - C8108 +# method-inverse - C8110 +# method-required-super - W8106 +# method-search - C8109 +# missing-newline-extrafiles - W7908 +# missing-readme - C7902 +# no-utf8-coding-comment - C8201 +# unnecessary-utf8-coding-comment - C8202 +# odoo-addons-relative-import - W7950 +# old-api7-method-defined - R8110 +# openerp-exception-warning - R8101 +# redundant-modulename-xml - W7909 +# sql-injection - E8103 +# too-complex - C0901 +# translation-field - W8103 +# translation-required - C8107 +# use-vim-comment - W8202 +# wrong-tabs-instead-of-spaces - W7910 +# xml-syntax-error - E7902 + + enable=anomalous-backslash-in-string, - api-one-deprecated, - api-one-multi-together, assignment-from-none, - attribute-deprecated, - class-camelcase, dangerous-default-value, - dangerous-view-replace-wo-priority, - duplicate-id-csv, + development-status-allowed, duplicate-key, - duplicate-xml-fields, - duplicate-xml-record-id, - eval-referenced, - eval-used, - incoherent-interpreter-exec-perm, - license-allowed, - manifest-author-string, - manifest-deprecated-key, - manifest-required-author, - manifest-required-key, - manifest-version-format, - method-compute, - method-inverse, - method-required-super, - method-search, + duplicate-po-message-definition, missing-import-error, missing-manifest-dependency, - openerp-exception-warning, + po-msgstr-variables, + po-syntax-error, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, relative-import, return-in-init, rst-syntax-error, - sql-injection, too-few-format-args, - translation-field, - translation-required, unreachable, - use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error, - # messages that do not cause the lint step to fail - consider-merging-classes-inherited, + eval-used, + eval-referenced, + license-allowed, + manifest-author-string, + manifest-required-author, + manifest-required-key, + manifest-version-format, + api-one-deprecated, + api-one-multi-together, + attribute-deprecated, + class-camelcase, create-user-wo-reset-password, + consider-merging-classes-inherited, + copy-wo-api-one, dangerous-filter-wo-user, + dangerous-view-replace-wo-priority, deprecated-module, + duplicate-id-csv, + duplicate-po-message-definition, + duplicate-xml-fields, + duplicate-xml-record-id, file-not-used, + incoherent-interpreter-exec-perm, invalid-commit, + javascript-lint, + manifest-deprecated-key, + method-compute, + method-inverse, + method-required-super, + method-search, missing-newline-extrafiles, missing-readme, + po-msgstr-variables, + po-syntax-error, no-utf8-coding-comment, + unnecessary-utf8-coding-comment, odoo-addons-relative-import, old-api7-method-defined, + openerp-exception-warning, redefined-builtin, + redundant-modulename-xml, + sql-injection, too-complex, - unnecessary-utf8-coding-comment + translation-field, + translation-required, + use-vim-comment, + wrong-tabs-instead-of-spaces, + xml-syntax-error, + [REPORTS] msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} output-format=colorized reports=no + diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 91d657d49..9b44956f4 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -13,53 +13,56 @@ valid_odoo_versions=12.0 [MESSAGES CONTROL] disable=all +# Enable message and code: +# anomalous-backslash-in-string - W1401 +# assignment-from-none - W1111 +# dangerous-default-value - W0102 +# duplicate-key - W0109 +# missing-import-error - W7935 +# missing-manifest-dependency - W7936 +# pointless-statement - W0104 +# pointless-string-statement - W0105 +# print-statement - E1601 +# redundant-keyword-arg - E1124 +# reimported - W0404 +# relative-import - W0403 +# return-in-init - E0101 +# rst-syntax-error - E7901 +# too-few-format-args - E1306 +# unreachable - W0101 + + + enable=anomalous-backslash-in-string, - api-one-deprecated, - api-one-multi-together, assignment-from-none, - attribute-deprecated, - class-camelcase, dangerous-default-value, - dangerous-view-replace-wo-priority, - duplicate-id-csv, + development-status-allowed, duplicate-key, - duplicate-xml-fields, - duplicate-xml-record-id, - eval-referenced, - eval-used, - incoherent-interpreter-exec-perm, - license-allowed, - manifest-author-string, - manifest-deprecated-key, - manifest-required-author, - manifest-required-key, - manifest-version-format, - method-compute, - method-inverse, - method-required-super, - method-search, + duplicate-po-message-definition, missing-import-error, missing-manifest-dependency, - openerp-exception-warning, + po-msgstr-variables, + po-syntax-error, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, relative-import, return-in-init, rst-syntax-error, - sql-injection, too-few-format-args, - translation-field, - translation-required, unreachable, - use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error + eval-used, + eval-referenced, + license-allowed, + manifest-author-string, + manifest-required-author, + manifest-required-key, + manifest-version-format [REPORTS] msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} output-format=colorized reports=no + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 654ccbccf..000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -language: python -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/pre-commit - -python: - - "3.5" - -addons: - postgresql: "9.6" - apt: - packages: - - expect-dev # provides unbuffer utility - -stages: - - linting - - test - -jobs: - include: - - stage: linting - python: 3.6 - name: "pre-commit" - before_install: - install: pip install pre-commit - script: pre-commit run --all --show-diff-on-failure --verbose --color always - after_success: - - stage: test - env: - - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" - - stage: test - env: - - TESTS="1" ODOO_REPO="OCA/OCB" - -env: - global: - - VERSION="12.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0" - -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/README.md b/README.md index b0a04ce96..df8e330d6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,37 @@ -[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/189/12.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-dms-292) -[![Build Status](https://travis-ci.org/OCA/dms.svg?branch=12.0)](https://travis-ci.org/OCA/dms) + +[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=12.0) +[![Pre-commit Status](https://github.com/OCA/dms/actions/workflows/pre-commit.yml/badge.svg?branch=12.0)](https://github.com/OCA/dms/actions/workflows/pre-commit.yml?query=branch%3A12.0) +[![Build Status](https://github.com/OCA/dms/actions/workflows/test.yml/badge.svg?branch=12.0)](https://github.com/OCA/dms/actions/workflows/test.yml?query=branch%3A12.0) [![codecov](https://codecov.io/gh/OCA/dms/branch/12.0/graph/badge.svg)](https://codecov.io/gh/OCA/dms) +[![Translation Status](https://translation.odoo-community.org/widgets/dms-12-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/dms-12-0/?utm_source=widget) + + + +# DMS for Odoo + +Document Management System + + + + + +[//]: # (addons) + +This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. + +[//]: # (end addons) + + + +## Licenses + +This repository is licensed under [AGPL-3.0](LICENSE). -Document Management System modules for Odoo -=========================================== +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 modules for DMS. +---- +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/requirements.txt b/requirements.txt index e69de29bb..9cd162922 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +# generated from manifests external_dependencies