2 Commits

Author SHA1 Message Date
Stéphan Sainléger
84284e6c68 [MIG] hide_portal_module_by_use: migrate to 18.0 2026-01-21 23:34:29 +01:00
Stéphan Sainléger
89711fed41 [MIG] init 18.0 2026-01-16 16:47:02 +01:00
19 changed files with 22 additions and 573 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:
pull_request:
branches:
- "16.0*"
jobs:
pre-commit:
@@ -13,10 +15,10 @@ jobs:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: https://gitea.com/actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
# - uses: actions/cache@v4
# 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

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__/
*.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/
*.*~
*.pyc

View File

@@ -49,9 +49,12 @@ repos:
$(git rev-parse --show-toplevel))"'
- id: oca-gen-addon-readme
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/@@")
--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'
- repo: https://github.com/OCA/odoo-pre-commit-hooks

View File

@@ -5,7 +5,7 @@
'name': 'Hide Portal Module By User',
'description': """
Show / Hide Specific Portal Docs on res.users""",
'version': '16.0.1.0.0',
'version': "18.0.1.0.0",
'license': 'AGPL-3',
'author': 'Munin',
'website': 'https://github.com/AxeldelosReyes/odoo_web_modules',

View File

@@ -1,7 +1,7 @@
from odoo import api, SUPERUSER_ID
def post_init_hook(cr, registry):
def post_init_hook(env):
"""Loaded after installing the module.
This module's DB modifications will be available.
:param odoo.sql_db.Cursor cr:
@@ -9,7 +9,6 @@ def post_init_hook(cr, registry):
:param odoo.modules.registry.RegistryManager registry:
Database registry, using v7 api.
"""
env = api.Environment(cr, SUPERUSER_ID, {})
portal_views = env['ir.ui.view'].search([('inherit_id.xml_id', '=', 'portal.portal_my_home')])
if portal_views:
for p in portal_views:

View File

@@ -1,24 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template inherit_id="portal.portal_docs_entry" id="hide_portal_user">
<xpath expr="//a" position="replace">
<t t-if="request.env.user.validate_portal_url(url)">
<a t-att-href="url" t-att-title="title"
class="list-group-item list-group-item-action d-flex align-items-center justify-content-between d-none">
<t t-esc="title" />
<t t-if='count'>
<span class="badge text-bg-secondary rounded-pill" t-esc="count" />
</t>
<t t-elif="placeholder_count">
<span class="badge text-bg-secondary rounded-pill"
t-att-data-placeholder_count="placeholder_count">
<i class="fa fa-spin fa-circle-o-notch"></i>
</span>
</t>
</a>
</t>
</xpath>
</template>
<template inherit_id="portal.portal_docs_entry" id="hide_portal_user">
<xpath expr="//a" position="attributes">
<attribute name="t-if">request.env.user.validate_portal_url(url)</attribute>
</xpath>
</template>
</data>
</odoo>
</odoo>

View File

@@ -10,7 +10,7 @@
<field name="arch" type="xml">
<field name="share" position="after">
<field name="portal_url" readonly="1"
attrs="{'invisible':[('portal_url','=',False)]}"/>
invisible="portal_url == False"/>
</field>
</field>
</record>

View File

@@ -1,52 +0,0 @@
====================
mail_message_copy_in_partner
====================
Installation
============
Use Odoo normal module installation procedure to install ``mail_message_copy_in_partner``.
Configuration
=============
Nothing to do
Usage
=====
If module is installed, notes will never send email to partners not linked to internal users.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/ux-tools/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
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -1,4 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View File

@@ -1,89 +0,0 @@
# Copyright 2022 Laetitia Élabore (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "mail_message_copy_in_partner",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://github.com/elabore-coop/ux-tools",
"maintainer": "Clément",
"license": "AGPL-3",
"category": "Tools",
"summary": "If current model has partner_id field, all messages will be copied in partner's chatter",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=================
mail_message_copy_in_partner
=================
If current model has partner_id field, all messages will be copied in partner's chatter
New message is a note without recipients
Installation
============
Install ``mail_message_copy_in_partner``, all dependencies will be installed by default.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website
<https://github.com/elabore-coop/ux-tools/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
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.
""",
# any module necessary for this one to work correctly
'depends' : ['base_setup'],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -1 +0,0 @@
from . import mail_thread

View File

@@ -1,24 +0,0 @@
from odoo import api, models, _
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.returns('mail.message', lambda value: value.id)
def message_post(self, body='', **kwargs):
#send message to related partner
if hasattr(self, 'partner_id') and self.partner_id:
msg = _('<b>[%(object)s]</b> %(body)s',object=self._get_html_link(), body=body)
new_kwargs = kwargs.copy()
#new message is a note
new_kwargs['subtype_xmlid'] = "mail.mt_note"
#do not send anything
new_kwargs['partner_ids'] = []
self.partner_id.message_post(body=msg, **new_kwargs)
return super(MailThread, self).message_post(body=body, **kwargs)

View File

@@ -1,52 +0,0 @@
====================
mail_prevent_send_note_to_external
====================
Installation
============
Use Odoo normal module installation procedure to install ``mail_prevent_send_note_to_external``.
Configuration
=============
Nothing to do
Usage
=====
If module is installed, notes will never send email to partners not linked to internal users.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/ux-tools/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
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -1,4 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View File

@@ -1,88 +0,0 @@
# Copyright 2022 Laetitia Élabore (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "mail_prevent_send_note_to_external",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://github.com/elabore-coop/ux-tools",
"maintainer": "Clément",
"license": "AGPL-3",
"category": "Tools",
"summary": "Prevent chatter note to send email to external partner",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=================
mail_prevent_send_note_to_external
=================
Prevent chatter note to send email to external partner
Installation
============
Install ``mail_prevent_send_note_to_external``, all dependencies will be installed by default.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website
<https://github.com/elabore-coop/ux-tools/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
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.
""",
# any module necessary for this one to work correctly
'depends' : ['base_setup'],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -1 +0,0 @@
from . import mail_thread

View File

@@ -1,19 +0,0 @@
from odoo import api, models, _
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.returns('mail.message', lambda value: value.id)
def message_post(self, **kwargs):
#check subtype_xmlid and partner_ids, and remove external partners if subtype is "note"
if kwargs.get("subtype_xmlid") == 'mail.mt_note' and "partner_ids" in kwargs:
new_partner_ids = []
for partner_id in kwargs["partner_ids"]:
user = self.env["res.users"].search([('partner_id','=',partner_id)])
if user.active and user.has_group('base.group_user'):
new_partner_ids.append(partner_id)
kwargs["partner_ids"] = new_partner_ids
message = super(MailThread, self).message_post(**kwargs)
return message