2 Commits

Author SHA1 Message Date
Stéphan Sainléger
438dcbeaf0 [MIG] sale_disable_product_creation_in_sale: migration to 18.0 2026-03-29 15:47:58 +02:00
Stéphan Sainléger
b6cfe0b027 [MIG] sale_usability_misc: migration to 18.0 2026-03-29 15:47:40 +02:00
12 changed files with 103 additions and 318 deletions

View File

@@ -1,42 +0,0 @@
#!/bin/bash
#
# Run the Python tests of the given Odoo modules.
#
# This script is meant to be executed *inside* an Elabore doodba image
# (docker.0k.io/mirror/odoo:rc_<version>-ELABORE-LIGHT), with a
# PostgreSQL service reachable at $PGHOST. The modules under test are
# read from the current working directory (the checked-out repository),
# which is prepended to the addons path so that the PR's code takes
# precedence over the modules already baked in the image.
#
# Usage: odoo-tests.sh <module1,module2,...>
set -euo pipefail
modules="${1:?usage: odoo-tests.sh <module1,module2,...>}"
export PGHOST=postgres
export PGUSER=odoo
export PGPASSWORD=odoopassword
export PGDATABASE="test_$(basename "$PWD" | tr '.-' '__')"
export WITHOUT_DEMO=all
export DB_FILTER='.*'
# Generate /opt/odoo/auto/odoo.conf from the environment and wait for
# the database to accept connections.
/opt/odoo/common/entrypoint
# Odoo test-tags format: "/module1,/module2" (one leading slash).
tags="/$(echo "$modules" | tr ',' ',/')"
exec odoo \
--config=/opt/odoo/auto/odoo.conf \
--max-cron-threads=0 \
--limit-time-real=10000 \
--workers=0 \
--test-enable \
--stop-after-init \
--addons-path="$PWD,/opt/odoo/auto/addons" \
-d "$PGDATABASE" \
-i "$modules" \
--test-tags "$tags"

View File

@@ -2,6 +2,8 @@ name: pre-commit
on: on:
pull_request: pull_request:
branches:
- "16.0*"
jobs: jobs:
pre-commit: pre-commit:
@@ -13,10 +15,10 @@ jobs:
python-version: "3.11" python-version: "3.11"
- name: Get python version - name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: https://gitea.com/actions/cache@v3 # - uses: actions/cache@v4
with: # with:
path: ~/.cache/pre-commit # path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} # key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit - name: Install pre-commit
run: pip install pre-commit run: pip install pre-commit
- name: Run pre-commit - name: Run pre-commit

View File

@@ -1,79 +0,0 @@
name: tests
on:
pull_request:
branches:
- "16.0*"
workflow_dispatch:
jobs:
test:
runs-on: odoo-ci
container:
image: docker.0k.io/mirror/odoo:rc_16.0-ELABORE-LIGHT
services:
postgres:
image: docker.0k.io/postgres:17.2.0-myc
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoopassword
POSTGRES_DB: postgres
steps:
# The doodba image ships no Node.js, so actions/checkout@v4 cannot
# run here. The repository is private, so the job token is required.
- name: Checkout
env:
SECRET_GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-${SECRET_GITEA_TOKEN:-${SECRET_GITHUB_TOKEN:-}}}}"
if [ -z "$token" ]; then
echo "::error::No job token available to clone the repository"
exit 1
fi
server="${GITHUB_SERVER_URL:-https://git.elabore.coop}"
repo="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is not set}"
ref="${GITHUB_REF:-${GITHUB_SHA:?neither GITHUB_REF nor GITHUB_SHA is set}}"
auth_url="$(printf '%s' "${server%/}/${repo}.git" |
sed -E "s#^https://#https://${token}@#")"
git init -q .
git config --global --add safe.directory "$PWD"
git remote add origin "$auth_url"
git fetch -q --depth=1 origin "$ref"
git checkout -q FETCH_HEAD
- name: Detect changed modules
id: changed
run: |
set -eu
if [ -n "${GITHUB_BASE_REF:-}" ]; then
git fetch -q --depth=1 origin "refs/heads/$GITHUB_BASE_REF"
base_rev="FETCH_HEAD"
scope="diff against $GITHUB_BASE_REF"
else
base_rev=""
scope="all installable modules (manual run)"
fi
if [ -n "$base_rev" ]; then
modules="$(
git diff --name-only "$base_rev" HEAD |
awk -F/ '{print $1}' | sort -u |
while read -r dir; do
[ -f "$dir/__manifest__.py" ] && echo "$dir"
done | paste -sd, -
)"
else
modules="$(
for dir in */; do
dir="${dir%/}"
[ -f "$dir/__manifest__.py" ] && echo "$dir"
done | paste -sd, -
)"
fi
echo "modules=$modules" >> "$GITHUB_OUTPUT"
echo "Modules to test ($scope): ${modules:-<none>}"
- name: Run Odoo tests
if: steps.changed.outputs.modules != ''
run: bash .gitea/scripts/odoo-tests.sh "${{ steps.changed.outputs.modules }}"

90
.gitignore vendored
View File

@@ -1,88 +1,2 @@
# Byte-compiled / optimized / DLL files *.*~
__pycache__/ *.pyc
*.py[cod]
/.venv
/.pytest_cache
/.ruff_cache
# C extensions
*.so
# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.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
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Pycharm
.idea
# Eclipse
.settings
# Visual Studio cache/options directory
.vs/
.vscode
# OSX Files
.DS_Store
# Django stuff:
*.log
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Sphinx documentation
docs/_build/
# Backup files
*~
*.swp
# OCA rules
!static/lib/

View File

@@ -49,9 +49,12 @@ repos:
$(git rev-parse --show-toplevel))"' $(git rev-parse --show-toplevel))"'
- id: oca-gen-addon-readme - id: oca-gen-addon-readme
entry: entry:
bash -c 'oca-gen-addon-readme --addons-dir=. --branch=$(git symbolic-ref bash -c 'oca-gen-addon-readme
--addons-dir=.
--branch=$(git symbolic-ref
refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@") refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")
--repo-name=$(basename $(git rev-parse --show-toplevel)) --org-name="Elabore" --repo-name=$(basename $(git rev-parse --show-toplevel))
--org-name="Elabore"
--if-source-changed --keep-source-digest' --if-source-changed --keep-source-digest'
- repo: https://github.com/OCA/odoo-pre-commit-hooks - repo: https://github.com/OCA/odoo-pre-commit-hooks

View File

@@ -0,0 +1,42 @@
# Sale - Disable Product Creation in Sale
Prevents users from creating new products directly from sale order lines.
## Description
By default, Odoo allows users to create new products on-the-fly when filling
in sale order lines via the *Product* field. This can lead to duplicate or
poorly configured products when the catalog should be managed centrally.
This module adds the `no_create` option to the `product_template_id` field in
the sale order line tree view, so users can only select existing products from
the catalog.
## Usage
Once installed, the *Create and edit…* and *Create* options are removed from
the product dropdown in sale order lines. Users must pick a product that
already exists in the product catalog.
No configuration is required.
## Installation
Install via the standard Odoo module installation procedure.
**Dependencies:** `base`, `sale`
## Credits
### Authors
- [Elabore](https://elabore.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).
## License
This module is licensed under **AGPL-3**. See the [LICENSE](LICENSE) file for
full details.

View File

@@ -1,50 +0,0 @@
===============
sale_usability_misc
===============
Various improves for Sales app
Installation
============
Use Odoo normal module installation procedure to install
``sale_usability_misc``.
Description
===========
- Allow group sales administores to see date_order field event if not in developper mode
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/sale_usability_misc/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.
Credits
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -3,7 +3,7 @@
{ {
"name": "sale_disable_product_creation_in_sale", "name": "sale_disable_product_creation_in_sale",
"version": "16.0.1.0.0", "version": "18.0.1.0.0",
"author": "Elabore", "author": "Elabore",
"website": "https://elabore.coop", "website": "https://elabore.coop",
"maintainer": "Elabore", "maintainer": "Elabore",

View File

@@ -6,7 +6,7 @@
<field name="model">sale.order</field> <field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" /> <field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree//field[@name='product_template_id']" position="attributes"> <xpath expr="//field[@name='order_line']/list//field[@name='product_template_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute> <attribute name="options">{'no_create': True}</attribute>
</xpath> </xpath>
</field> </field>

View File

@@ -0,0 +1,45 @@
# Sale - Usability Misc
Miscellaneous usability improvements for the Odoo Sales app.
## Description
This module adjusts field visibility on the sale order form so that key
information is accessible to **Sales Managers** without requiring developer
mode.
### Changes
| Field | Default visibility | New visibility |
|---|---|---|
| **Order Date** (`date_order`) | Developer mode only (`base.group_no_one`) | Sales Managers (`sales_team.group_sale_manager`) |
| **Opportunity** (`opportunity_id`) | Developer mode only (`base.group_no_one`) | Sales Managers (`sales_team.group_sale_manager`) |
## Usage
Once installed, users with the *Sales / Manager* role can see and edit the
**Order Date** and **Opportunity** fields directly on the sale order form,
without activating developer mode.
No configuration is required.
## Installation
Install via the standard Odoo module installation procedure.
**Dependencies:** `base`, `sale`, `sales_team`, `sale_crm`
## Credits
### Authors
- [Elabore](https://elabore.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).
## License
This module is licensed under **AGPL-3**. See the [LICENSE](LICENSE) file for
full details.

View File

@@ -1,50 +0,0 @@
===============
sale_usability_misc
===============
Various improves for Sales app
Installation
============
Use Odoo normal module installation procedure to install
``sale_usability_misc``.
Description
===========
- Allow group sales administores to see date_order field event if not in developper mode
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/sale_usability_misc/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.
Credits
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -3,7 +3,7 @@
{ {
"name": "sale_usability_misc", "name": "sale_usability_misc",
"version": "16.0.1.0.1", "version": "18.0.1.0.0",
"author": "Elabore", "author": "Elabore",
"website": "https://elabore.coop", "website": "https://elabore.coop",
"maintainer": "Elabore", "maintainer": "Elabore",