From 4a98206ac10dc166e57c57f2267b8638c08619eb Mon Sep 17 00:00:00 2001 From: Carmen Bianca BAKKER Date: Mon, 5 Dec 2022 17:45:20 +0100 Subject: [PATCH 1/4] [ADD] website_sale_product_availability Signed-off-by: Carmen Bianca BAKKER --- website_sale_product_availability/__init__.py | 2 ++ .../__manifest__.py | 25 +++++++++++++++ .../readme/CONTRIBUTORS.rst | 3 ++ .../readme/DESCRIPTION.rst | 1 + .../readme/USAGE.rst | 4 +++ .../views/templates.xml | 32 +++++++++++++++++++ 6 files changed, 67 insertions(+) create mode 100644 website_sale_product_availability/__init__.py create mode 100644 website_sale_product_availability/__manifest__.py create mode 100644 website_sale_product_availability/readme/CONTRIBUTORS.rst create mode 100644 website_sale_product_availability/readme/DESCRIPTION.rst create mode 100644 website_sale_product_availability/readme/USAGE.rst create mode 100644 website_sale_product_availability/views/templates.xml diff --git a/website_sale_product_availability/__init__.py b/website_sale_product_availability/__init__.py new file mode 100644 index 0000000..4fc7ef9 --- /dev/null +++ b/website_sale_product_availability/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2022 Coop IT Easy SC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/website_sale_product_availability/__manifest__.py b/website_sale_product_availability/__manifest__.py new file mode 100644 index 0000000..4b766e7 --- /dev/null +++ b/website_sale_product_availability/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2022 Coop IT Easy SC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Website Sale Product Availability", + "summary": """ + Display the quantity of products available on the product overview.""", + "version": "12.0.1.0.0", + "category": "Website", + "website": "https://github.com/OCA/e-commerce", + "author": "Coop IT Easy SC", + "maintainers": ["carmenbianca"], + "license": "AGPL-3", + "application": False, + "depends": [ + "website_sale", + "website_sale_stock", + ], + "excludes": [], + "data": [ + "views/templates.xml", + ], + "demo": [], + "qweb": [], +} diff --git a/website_sale_product_availability/readme/CONTRIBUTORS.rst b/website_sale_product_availability/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..f1ac675 --- /dev/null +++ b/website_sale_product_availability/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Coop IT Easy SC `_: + + * Carmen Bianca BAKKER diff --git a/website_sale_product_availability/readme/DESCRIPTION.rst b/website_sale_product_availability/readme/DESCRIPTION.rst new file mode 100644 index 0000000..f7746b4 --- /dev/null +++ b/website_sale_product_availability/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Display the quantity of products available on the e-commerce product overview. diff --git a/website_sale_product_availability/readme/USAGE.rst b/website_sale_product_availability/readme/USAGE.rst new file mode 100644 index 0000000..09ab102 --- /dev/null +++ b/website_sale_product_availability/readme/USAGE.rst @@ -0,0 +1,4 @@ +After installing the module, go to the 'eCommerce' tab on your products. Change +the 'Availability' setting from 'Sell regardless of inventory' to 'Show +inventory [...]' if you want to show the availability on the product overview +page in the e-commerce. diff --git a/website_sale_product_availability/views/templates.xml b/website_sale_product_availability/views/templates.xml new file mode 100644 index 0000000..0c6957c --- /dev/null +++ b/website_sale_product_availability/views/templates.xml @@ -0,0 +1,32 @@ + + + + + From e285b1700225d0b5e500d8e9a84e2e0c92addf1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 14 Dec 2023 17:22:38 +0100 Subject: [PATCH 2/4] [IMP] w_s_product_availability: name html tags This improvement allow to style the availability and also to perform other xpath on this element. It allow also to move or add the availability elsewhere for design or readability purposes. --- .../views/templates.xml | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/website_sale_product_availability/views/templates.xml b/website_sale_product_availability/views/templates.xml index 0c6957c..fb2437c 100644 --- a/website_sale_product_availability/views/templates.xml +++ b/website_sale_product_availability/views/templates.xml @@ -9,24 +9,30 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). expr="//div[@itemscope='itemscope']//div[hasclass('product_price')]//b" position="after" > - - - available - - - - - available - - In stock + + + + From 6211d3ef820108f41f53864e115f5496ec3d4a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Fri, 15 Dec 2023 10:45:26 +0100 Subject: [PATCH 3/4] [UPD] CI --- .copier-answers.yml | 7 +++---- .github/workflows/pre-commit.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- .pre-commit-config.yaml | 21 +++++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 6bd9b1d..e6d4112 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,15 +1,16 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v2.1.2 +_commit: v2.1.10 _src_path: https://github.com/coopiteasy/oca-addons-repo-template.git ci: GitHub -dependency_installation_mode: OCA 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: OCB odoo_version: 12.0 org_name: Coop IT Easy SC org_slug: coopiteasy @@ -19,6 +20,4 @@ repo_description: Modules aiming to support e-commerce-specific needs. This incl repo_name: E-commerce modules repo_slug: cie-e-commerce repo_website: https://coopiteasy.be -travis_apt_packages: [] -travis_apt_sources: [] diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index c7abad2..f86d418 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,12 +11,12 @@ on: jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.6" - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb575ba..f38e9b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 container: ${{ matrix.container }} name: ${{ matrix.name }} strategy: @@ -19,8 +19,8 @@ jobs: matrix: include: - container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest - makepot: "true" name: test with OCB + makepot: "true" services: postgres: image: postgres:9.6 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6d6bb7c..6e83828 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ exclude: | # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: - python: python3 + python: python3.6 repos: - repo: local hooks: @@ -51,15 +51,17 @@ repos: hooks: - id: black additional_dependencies: ["click<8.1.0"] + # fixes a bug because upstream sets this to `python3` + language_version: python3.6 - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.4.1 + rev: v1.19.1 hooks: - id: prettier name: prettier (with plugin-xml) entry: prettier --write --list-different additional_dependencies: - - "prettier@2.4.1" - - "@prettier/plugin-xml@1.1.0" + - "prettier@1.19.1" + - "@prettier/plugin-xml@0.7.2" files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - repo: https://github.com/pre-commit/mirrors-eslint rev: v6.8.0 @@ -103,7 +105,7 @@ repos: name: isort except __init__.py exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 3.0.6 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -113,14 +115,13 @@ repos: - --header - "# generated from manifests external_dependencies" - repo: https://github.com/OCA/mirrors-flake8 - rev: v3.7.9 + rev: v3.4.1 hooks: - id: flake8 - language_version: python3 name: flake8 excluding __init__.py exclude: __init__\.py - - repo: https://github.com/PyCQA/pylint - rev: v2.11.1 + - repo: https://github.com/pre-commit/mirrors-pylint + rev: v2.5.3 hooks: - id: pylint name: pylint with optional checks @@ -129,7 +130,7 @@ repos: - --exit-zero verbose: true additional_dependencies: &pylint_deps - - pylint-odoo==5.0.5 + - pylint-odoo==3.5.0 - id: pylint name: pylint with mandatory checks args: From c012fd6c2f034aa937f8afec402f03ed6822788f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Fri, 15 Dec 2023 10:46:29 +0100 Subject: [PATCH 4/4] [FIX] linting --- .../addons/website_sale_product_availability | 1 + .../setup.py | 6 +++++ .../__manifest__.py | 2 +- .../views/templates.xml | 23 +++++++++++++++---- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 120000 setup/website_sale_product_availability/odoo/addons/website_sale_product_availability create mode 100644 setup/website_sale_product_availability/setup.py diff --git a/setup/website_sale_product_availability/odoo/addons/website_sale_product_availability b/setup/website_sale_product_availability/odoo/addons/website_sale_product_availability new file mode 120000 index 0000000..13bd623 --- /dev/null +++ b/setup/website_sale_product_availability/odoo/addons/website_sale_product_availability @@ -0,0 +1 @@ +../../../../website_sale_product_availability \ No newline at end of file diff --git a/setup/website_sale_product_availability/setup.py b/setup/website_sale_product_availability/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/website_sale_product_availability/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_sale_product_availability/__manifest__.py b/website_sale_product_availability/__manifest__.py index 4b766e7..cf64342 100644 --- a/website_sale_product_availability/__manifest__.py +++ b/website_sale_product_availability/__manifest__.py @@ -7,7 +7,7 @@ Display the quantity of products available on the product overview.""", "version": "12.0.1.0.0", "category": "Website", - "website": "https://github.com/OCA/e-commerce", + "website": "https://coopiteasy.be", "author": "Coop IT Easy SC", "maintainers": ["carmenbianca"], "license": "AGPL-3", diff --git a/website_sale_product_availability/views/templates.xml b/website_sale_product_availability/views/templates.xml index fb2437c..fb3d783 100644 --- a/website_sale_product_availability/views/templates.xml +++ b/website_sale_product_availability/views/templates.xml @@ -25,14 +25,27 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). website_sale_stock.product_availability, so it's probably fine. --> - available + available - - - available + + + available - In stock + In stock