diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000000..fa17fcd4e85 --- /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 00000000000..3c7dc18b237 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,95 @@ +name: tests + +on: + pull_request_target: + branches: + - "18.0" + push: + branches: + - "18.0" + +env: + CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + CI_PROJECT_NAMESPACE: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + CI_PROJECT_NAME: ${{ github.event.pull_request.head.repo.name || github.event.repository.name }} + +jobs: + pre-commit-vauxoo: + runs-on: ubuntu-latest + name: pre-commit-vauxoo + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ env.CI_COMMIT_SHA }} + - name: Cache pre-commit and pip packages + id: cache-pre-commit-pip + uses: actions/cache@v3 + with: + path: | + ~/.cache/pre-commit + ~/.cache/pip + key: cache-pre-commit-pip + - name: Install pre-commit-vauxoo + run: pip install --upgrade pre-commit-vauxoo + - name: Run pre-commit-vauxoo + run: pre-commit-vauxoo + no-dependency-files: + runs-on: ubuntu-latest + name: No dependency files + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ env.CI_COMMIT_SHA }} + - name: Ensure dependency files don't exist + run: | + for reqfile in requirements.txt oca_dependencies.txt ; do + if [ -f ${reqfile} ] ; then + echo "Please avoid adding requirement files to this repo, because requirements will be installed in all project depending on this one." + echo "If you need them for test to work, you can use test-${reqfile} instead of ${reqfile}" + exit 1 + fi + done + build_docker: + runs-on: ubuntu-latest + name: Build Docker and test Odoo + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ env.CI_COMMIT_SHA }} + persist-credentials: false + - name: Cache pip packages + id: cache-pip-build + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: cache-pip-build + - name: Set ssh keys + run: | + ssh-agent -a $SSH_AUTH_SOCK > /dev/null + ssh-add - <<< "${{ secrets.PRIVATE_DEPLOY_KEY }}" + mkdir -p ~/.ssh/ + ssh-keyscan -H git.vauxoo.com >> ~/.ssh/known_hosts + - name: Install dependencies + run: | + pip install -U deployv vxci + sudo apt update + sudo apt install dos2unix + - name: Build image + env: + PRIVATE_DEPLOY_KEY: ${{ secrets.PRIVATE_DEPLOY_KEY }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_USER: ${{ secrets.DOCKER_USER }} + ORCHEST_REGISTRY: ${{ secrets.ORCHEST_REGISTRY }} + ORCHEST_TOKEN: ${{ secrets.ORCHEST_TOKEN }} + run: | + source variables.sh + vxci check_keys + vxci build_image --push_image + - name: Test odoo image + run: | + source variables.sh + slugified_branch=$(python -c "from vxci.common import slugify; print(slugify('${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}'))") + source ${slugified_branch}/image_name.env + vxci test_repo --allow_deprecated diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..04fa236843d --- /dev/null +++ b/.gitignore @@ -0,0 +1,87 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +*.DS_Store* + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coveragerc +.coverage.* +et +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo + +# Pycharm +.idea + +# VS Code +.vscode + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Sphinx documentation +docs/_build/ + +# Backup files +*~ +*.swp + +# docker JSON packages +package-lock.json +package.json + +# docker node_modules +node_modules/ + +# pre-commit-vauxoo +.bandit* +.config/ +.editorconfig +.eslintrc* +.flake8* +.isort.cfg +.oca_hooks* +.pre-commit*.yaml +.prettierrc.yml +.pylintrc* +bandit*.yaml +doc8.ini +pyproject.toml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..ae908e68c98 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,189 @@ +Reporting Issues +---------------- + +1. Make sure you've actually read the error message if there is one, it may really help +2. No need to create an issue if you're [making a PR](#making-pull-requests) to fix it. Describe the issue in the PR, it's the same as an issue, but with higher priority! +2. Double-check that the issue still occurs with the latest version of Odoo (you can easily test this on [Runbot](https://runbot.vauxoo.com)) +3. [Search](https://github.com/vauxoo/addons-vauxoo/issues) for similar issues before reporting anything +4. If you're a programmer, try investigating/fixing yourself, and consider making a Pull Request instead +5. If you really think a new issue is useful, keep in mind that it will be treated with a much lower priority than a Pull Request or a Vauxoo Enterprise support ticket + +If later on you create a pull request solving an opened issue, do not forget to reference it in your pull request (e.g.: "This patch fixes issue #42"). + +When reporting an issue or creating a pull request, please **use the following template**: + +``` +**Quantity field is ignored in a sale order** + +Impacted versions: + + - 18.0 + +Steps to reproduce: + + 1. create a new sale order + 2. add a line with product 'Service', quantity 2, unit price 10.0 + 3. validate the sale order + +Current behavior: + + - Total price of 10.0 + +Expected behavior: + + - Total price of 20.0 (2 * 10 = 20) +``` + +Hacking this set of modules. +--- + +The main idea is to create a little how-to commit by commit to know how to improve +this modules in a clean way and help us to help you, then if you are including +your new concepts try to be explicit and helpful in your commit messages. + +How add a new feature: +--- + +0. Clone this repository: + + ```bash + $ git clone git@github.com:vauxoo/addons-vauxoo.git -b 18.0 + $ cd addons-vauxoo + $ git remote add your-name git@github.com:your-github-name/addons-vauxoo.git # << to push your changes + ``` + +1. **Before declaring this repository as part of your addons-path:** Install all + external dependencies. **note**: + You will need some non-standar packages (npm and lessc to be precise) when + you have v18.0 installed. + +2. Create your own branch locally. + + ```bash + $ git checkout -b 18.0-your_new_feature_theme-your-name + ``` + +3. Push your first change branch to know you start to work on. + + ```bash + $ git push -u origin 18.0-your_new_feature_theme-your-name + ``` + +4. Prepare your environment to work with this repository and the mandatory ones + to have all the environment ready. + + ```bash + $ git clone https://github.com/odoo/odoo.git -b 18.0 + $ git clone https://github.com/vauxoo/addons-vauxoo.git -b 18.0 + ``` + +5. Create a postgres user (only for this work to avoid problems not related to this environment). + + ```bash + $ sudo su postgres + $ createuser testuser -P + ##### put your password just the number one (1) for example. + $ createdb test -U testuser -O testuser -T template0 -E UTF8 + ``` + +6. Run the development environment. + + ```bash + $ cd path/to/odoo/odoo + $ ./odoo-bin \ + --addons-path=addons/,../addons-vauxoo -r \ + testuser -w 1 --db-filter=test \ + -i module_to_improve -d test + ``` + +7. Do your code, code, code, code and update it passing -u module -d test (replacing this parameter above). + +8. Before you need to be sure all is ok, we can delete and create db again with -i + parameter to ensure all install correctly. + + ```bash + $ sudo su postgres + $ dropbd test + $ createdb test -U testuser -O testuser -T template0 -E UTF8 + $ ./odoo-bin \ + --addons-path=addons/,../addonstest-vauxoo,../server-tools -r \ + testuser -w 1 --db-filter=test \ + -i module_to_improve -d test + ``` + +9. If all is ok installing, please test your environment running your code with ?test-enabled?. + + ```bash + $ ./odoo-bin --addons-path=addons/,../addons-vauxoo,../test -r \ + testuser -w 1 --db-filter=test \ + -i module_to_improve-d test --test-enable + ``` + +**Note:** + + This will take a time, just do it before commiting your changes and make push. + +10. Add your changes to have them versioned. + + ```bash + $ git add . + ``` + +11. Commit your changes. + + ```bash + $ git commit -m "[TAG] module: what you did" + ``` + +12. Push your first change branch to know you start to work on. + + ```bash + $ git push -u your-name 18.0-your_new_feature_theme-your-name + ``` + +13. Make a PR with your changes as you usually do it with github's web + interface or using [hub](https://github.com/github/hub). + +Modules Conventions +--- + +- **Descriptions**. + - Descriptions of modules can be on a README.md, README.rst, avoid put the + descriptions directly on the descriptor __openerp__.py file, the best way to + do something new is using a README.md file in some moment all our modules + will be on that way. +- **Dependencies**. + - Try to avoid imports of external libraries without a try, except to manage a + WARNING controlling the external error, if is mandatory such need. +- **Module Structure**. + - The structure of all internal odoo stuff try to follow the rules under + [OCA](http://odoo-community.org), and remember always do what we say and not + what we do ;-) if you find things that do not comply such rules, it can be + considered a bug, please share with us what you find and Pull Requests are + welcome. +- **Naming convention.** + - All modules must start with the name of meta functional area which they will + work with, i.e: `account_*`, `website_*`, `sale_*`. + - The module should not contain names not precises like `*_extra` or + `*_extension` if your module do whatever call it whatever. +- **Reasons because a module can be here.** + - The feature is generic. + - The module can work standalone or combined with other modules here or in + [OCA](https://github.com/OCA). + - Feature is planned to be maintained in future versions, very specific + features which are specific for a user case on a customer can not be + here. +- **Coding** + - *Python*: We try to follow pep8 and check with pylint all our Pull + requests, to verify this locally just read the .travis file and replicate + such verification locally. + - *XML and HTML* We try to have 4 space for indentation, avoid the tabs, + and try to have all initial tag declaration in one line except for reports + declaration which can be in one line per attribute, this is not verified + by any lint checker but it is good if you help us there. + +Issues +--- + +- Where?: [here](https://github.com/Vauxoo/addons-vauxoo/issues/new) +- How? Follow [odoo?s](https://github.com/odoo/odoo/blob/18.0/CONTRIBUTING.md) standard to put your issues. diff --git a/README.md b/README.md index c0cd6ca14b2..f9be940b83b 100644 --- a/README.md +++ b/README.md @@ -1 +1,36 @@ -# Addons Vauxoo +[![Vauxoo Logo](https://www.vauxoo.com/logo.png)](https://www.vauxoo.com) + +[![Runbot Status](https://runbot.vauxoo.com/runbot/badge/230/18.0.svg)](https://runbot.vauxoo.com/runbot/repo/git-github-com-vauxoo-addons-vauxoo-git-230) +[![GitHub Actions Build Status](https://github.com/Vauxoo/addons-vauxoo/actions/workflows/test.yml/badge.svg)](https://github.com/Vauxoo/addons-vauxoo/actions) + +Vauxoo modules for Odoo +======================= + +On this project we try to mantain all our generic modules that can be used as +little extensions of odoo. + +If a module is here frequently is because such need comply a very specific need +of a customer and we considered such feature is generic enought to share on +this repository. + +The combination of several of this modules compliment other projects like +odoo-mexico, odoo-venezuela, odoo-ifrs, odoo-afr look on [our github +page](https://github.com/Vauxoo) for such repositories and the utilities where +this modules are used. + +Repositories which we depend from. +---------------------------------- + +Read the oca_dependencies.txt file for more information. TODO: + +Python Libraries which we depend from. +-------------------------------------- + +Read the requirements.txt file for more information. + +Do you want to contribute? +-------------------------- + +[Read the way](https://github.com/Vauxoo/addons-vauxoo/blob/9.0/CONTRIBUTING.md). + +#Better go with [Vauxoo](http://vauxoo.com) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/variables.sh b/variables.sh new file mode 100644 index 00000000000..e74a10fecd9 --- /dev/null +++ b/variables.sh @@ -0,0 +1,15 @@ +export BASE_IMAGE="vauxoo/odoo-180-image" +export DOCKER_IMAGE_REPO="quay.io/vauxoo/addons_vauxoo" +export PSQL_VERSION="17" +export VERSION="18.0" +export ODOO_REPO="vauxoo/odoo" +export ODOO_BRANCH="18.0" +export MAIN_APP="default_warehouse_from_sale_team" +export TRAVIS_PYTHON_VERSION="3.12" +export TRAVIS_REPO_SLUG="Vauxoo/" +export COUNTRY="MX" +export CUSTOMER="default_warehouse_from_sale_team" +export COVERAGE_MIN="80" +export COVERAGE_PRECISION="2" +export PRECOMMIT_HOOKS_TYPE="all" +export REQUIREMENTS_NON_RECURSIVE="true"