Skip to content

Commit

Permalink
Merge PR #26 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by remytms
  • Loading branch information
github-grap-bot committed Dec 20, 2023
2 parents 4822498 + c012fd6 commit 1040a16
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 18 deletions.
7 changes: 3 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: []

4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ on:

jobs:
test:
runs-on: ubuntu-latest
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
makepot: "true"
name: test with OCB
makepot: "true"
services:
postgres:
image: postgres:9.6
Expand Down
21 changes: 11 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions setup/website_sale_product_availability/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
2 changes: 2 additions & 0 deletions website_sale_product_availability/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2022 Coop IT Easy SC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
25 changes: 25 additions & 0 deletions website_sale_product_availability/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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://coopiteasy.be",
"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": [],
}
3 changes: 3 additions & 0 deletions website_sale_product_availability/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Carmen Bianca BAKKER
1 change: 1 addition & 0 deletions website_sale_product_availability/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Display the quantity of products available on the e-commerce product overview.
4 changes: 4 additions & 0 deletions website_sale_product_availability/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -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.
51 changes: 51 additions & 0 deletions website_sale_product_availability/views/templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2022 Coop IT Easy SC
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<template id="products_item" inherit_id="website_sale.products_item">
<xpath
expr="//div[@itemscope='itemscope']//div[hasclass('product_price')]//b"
position="after"
>
<span name="product_availability" class="product_availability">
<t t-call="website_sale_product_availability.product_availability" />
</span>
</xpath>
</template>

<template id="product_availability">
<span t-if="product.inventory_availability == 'always'">
<!--
FIXME: This doesn't seem like good i18n practice to me. What
if another language says e.g. 'available $qty $uom'?
However, it's also done like this in
website_sale_stock.product_availability, so it's probably
fine.
-->
<t t-esc="product.sudo().virtual_available" /> <t
t-esc="product.uom_name"
/> available
</span>
<span t-if="product.inventory_availability == 'threshold'">
<t
t-if="product.sudo().virtual_available &lt;= product.available_threshold"
>
<i
class="fa fa-exclamation-triangle"
title="Warning"
role="img"
aria-label="Warning"
/>
<t t-esc="product.sudo().virtual_available" /> <t
t-esc="product.uom_name"
/> available
</t>
<t
t-if="product.sudo().virtual_available &gt; product.available_threshold"
>In stock</t>
</span>
</template>
</odoo>

0 comments on commit 1040a16

Please sign in to comment.