Compare commits
27 Commits
16.0
...
568f49c784
| Author | SHA1 | Date | |
|---|---|---|---|
| 568f49c784 | |||
| 54bb9f0788 | |||
| d6b87de53c | |||
| 42676fcdd0 | |||
|
|
e14eafed39 | ||
|
|
78c6de7ecb | ||
| 626f5638c7 | |||
| e2c150b9b0 | |||
| a19873da78 | |||
|
|
b9c25f1158 | ||
|
|
ab50455ad3 | ||
|
|
adeae4235d | ||
| 949af68653 | |||
| de892cd63c | |||
| 3be634d864 | |||
| 45341d629c | |||
|
|
f74229181b | ||
|
|
8cef75a9b3 | ||
|
|
d6c6872c5c | ||
|
|
07669b8bf9 | ||
| bb6891d825 | |||
| 64b8e45af1 | |||
| 93de63c290 | |||
| 1f53587a3f | |||
| e45ad867c0 | |||
| 95dc32803f | |||
| 9cd897fb0c |
42
.gitea/scripts/odoo-tests.sh
Executable file
42
.gitea/scripts/odoo-tests.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/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"
|
||||
@@ -2,8 +2,6 @@ name: pre-commit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "16.0*"
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
@@ -15,10 +13,10 @@ jobs:
|
||||
python-version: "3.11"
|
||||
- name: Get python version
|
||||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
# - uses: actions/cache@v4
|
||||
# with:
|
||||
# path: ~/.cache/pre-commit
|
||||
# key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
- uses: https://gitea.com/actions/cache@v3
|
||||
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
|
||||
|
||||
79
.gitea/workflows/test.yml
Normal file
79
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,79 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "18.0*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: odoo-ci
|
||||
container:
|
||||
image: docker.0k.io/mirror/odoo:rc_18.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
90
.gitignore
vendored
@@ -1,2 +1,88 @@
|
||||
*.*~
|
||||
*.pyc
|
||||
# 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/
|
||||
|
||||
@@ -22,7 +22,7 @@ exclude: |
|
||||
(LICENSE.*|COPYING.*)
|
||||
default_language_version:
|
||||
python: python3
|
||||
node: "16.17.0"
|
||||
node: "22.9.0"
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
@@ -38,8 +38,12 @@ repos:
|
||||
entry: found a en.po file
|
||||
language: fail
|
||||
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
||||
- repo: https://github.com/sbidoul/whool
|
||||
rev: v1.3
|
||||
hooks:
|
||||
- id: whool-init
|
||||
- repo: https://github.com/oca/maintainer-tools
|
||||
rev: f9b919b9868143135a9c9cb03021089cabba8223
|
||||
rev: b89f767503be6ab2b11e4f50a7557cb20066e667
|
||||
hooks:
|
||||
# update the NOT INSTALLABLE ADDONS section above
|
||||
- id: oca-update-pre-commit-excluded-addons
|
||||
@@ -49,16 +53,13 @@ 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"
|
||||
--if-source-changed --keep-source-digest'
|
||||
|
||||
--repo-name=$(basename $(git rev-parse --show-toplevel)) --org-name="Elabore"
|
||||
--if-source-changed --keep-source-digest --convert-fragments-to-markdown'
|
||||
- id: oca-gen-external-dependencies
|
||||
- repo: https://github.com/OCA/odoo-pre-commit-hooks
|
||||
rev: v0.1.4
|
||||
rev: v0.0.33
|
||||
hooks:
|
||||
- id: oca-checks-odoo-module
|
||||
- id: oca-checks-po
|
||||
@@ -77,8 +78,8 @@ repos:
|
||||
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
|
||||
language: node
|
||||
additional_dependencies:
|
||||
- "prettier@2.7.1"
|
||||
- "@prettier/plugin-xml@2.2.0"
|
||||
- "prettier@3.3.3"
|
||||
- "@prettier/plugin-xml@3.4.1"
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: eslint
|
||||
@@ -91,10 +92,11 @@ repos:
|
||||
types: [javascript]
|
||||
language: node
|
||||
additional_dependencies:
|
||||
- "eslint@8.24.0"
|
||||
- "eslint-plugin-jsdoc@"
|
||||
- "eslint@9.12.0"
|
||||
- "eslint-plugin-jsdoc@50.3.1"
|
||||
- "globals@16.0.0"
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# exclude autogenerated files
|
||||
@@ -115,23 +117,8 @@ repos:
|
||||
- id: check-xml
|
||||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
- repo: https://github.com/PyCQA/docformatter
|
||||
rev: v1.7.7
|
||||
hooks:
|
||||
- id: docformatter
|
||||
args: [
|
||||
"--in-place", # modify the files
|
||||
"--recursive", # run on all the files
|
||||
"--wrap-summaries",
|
||||
"88", # max length of 1st line
|
||||
"--wrap-descriptions",
|
||||
"88", # max length of other lines
|
||||
"--pre-summary-newline", # new line before a long summary
|
||||
"--make-summary-multi-line", # force summary on multilines
|
||||
]
|
||||
additional_dependencies: ["tomli"] # if Python <3.11
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.12.0
|
||||
rev: v0.6.8
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
|
||||
75
.pylintrc
75
.pylintrc
@@ -10,7 +10,7 @@ manifest-required-authors=Elabore
|
||||
manifest-required-keys=license
|
||||
manifest-deprecated-keys=description,active
|
||||
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
||||
valid-odoo-versions=16.0
|
||||
valid-odoo-versions=18.0
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=all
|
||||
@@ -25,19 +25,25 @@ disable=all
|
||||
enable=anomalous-backslash-in-string,
|
||||
api-one-deprecated,
|
||||
api-one-multi-together,
|
||||
assignment-from-none,
|
||||
attribute-deprecated,
|
||||
class-camelcase,
|
||||
dangerous-default-value,
|
||||
dangerous-view-replace-wo-priority,
|
||||
development-status-allowed,
|
||||
duplicate-id-csv,
|
||||
duplicate-key,
|
||||
duplicate-xml-fields,
|
||||
duplicate-xml-record-id,
|
||||
eval-referenced,
|
||||
eval-used,
|
||||
incoherent-interpreter-exec-perm,
|
||||
openerp-exception-warning,
|
||||
redundant-modulename-xml,
|
||||
relative-import,
|
||||
rst-syntax-error,
|
||||
wrong-tabs-instead-of-spaces,
|
||||
xml-syntax-error,
|
||||
assignment-from-none,
|
||||
attribute-deprecated,
|
||||
dangerous-default-value,
|
||||
development-status-allowed,
|
||||
duplicate-key,
|
||||
eval-used,
|
||||
license-allowed,
|
||||
manifest-author-string,
|
||||
manifest-deprecated-key,
|
||||
@@ -48,73 +54,68 @@ enable=anomalous-backslash-in-string,
|
||||
method-inverse,
|
||||
method-required-super,
|
||||
method-search,
|
||||
openerp-exception-warning,
|
||||
pointless-statement,
|
||||
pointless-string-statement,
|
||||
print-used,
|
||||
redundant-keyword-arg,
|
||||
redundant-modulename-xml,
|
||||
reimported,
|
||||
relative-import,
|
||||
return-in-init,
|
||||
rst-syntax-error,
|
||||
sql-injection,
|
||||
too-few-format-args,
|
||||
translation-field,
|
||||
translation-required,
|
||||
unreachable,
|
||||
use-vim-comment,
|
||||
wrong-tabs-instead-of-spaces,
|
||||
xml-syntax-error,
|
||||
attribute-string-redundant,
|
||||
character-not-valid-in-resource-link,
|
||||
consider-merging-classes-inherited,
|
||||
context-overridden,
|
||||
create-user-wo-reset-password,
|
||||
dangerous-filter-wo-user,
|
||||
dangerous-qweb-replace-wo-priority,
|
||||
deprecated-data-xml-node,
|
||||
deprecated-openerp-xml-node,
|
||||
duplicate-po-message-definition,
|
||||
except-pass,
|
||||
file-not-used,
|
||||
invalid-commit,
|
||||
manifest-maintainers-list,
|
||||
missing-newline-extrafiles,
|
||||
missing-readme,
|
||||
missing-return,
|
||||
odoo-addons-relative-import,
|
||||
old-api7-method-defined,
|
||||
po-msgstr-variables,
|
||||
po-syntax-error,
|
||||
renamed-field-parameter,
|
||||
resource-not-exist,
|
||||
str-format-used,
|
||||
test-folder-imported,
|
||||
translation-contains-variable,
|
||||
translation-positional-used,
|
||||
unnecessary-utf8-coding-comment,
|
||||
website-manifest-key-not-valid-uri,
|
||||
xml-attribute-translatable,
|
||||
xml-deprecated-qweb-directive,
|
||||
xml-deprecated-tree-attribute,
|
||||
external-request-timeout,
|
||||
# messages that do not cause the lint step to fail
|
||||
attribute-string-redundant,
|
||||
consider-merging-classes-inherited,
|
||||
context-overridden,
|
||||
except-pass,
|
||||
invalid-commit,
|
||||
manifest-maintainers-list,
|
||||
missing-readme,
|
||||
missing-return,
|
||||
odoo-addons-relative-import,
|
||||
renamed-field-parameter,
|
||||
resource-not-exist,
|
||||
test-folder-imported,
|
||||
translation-contains-variable,
|
||||
translation-positional-used,
|
||||
website-manifest-key-not-valid-uri,
|
||||
external-request-timeout,
|
||||
missing-manifest-dependency,
|
||||
too-complex,,
|
||||
create-user-wo-reset-password,
|
||||
dangerous-filter-wo-user,
|
||||
deprecated-module,
|
||||
file-not-used,
|
||||
invalid-commit,
|
||||
missing-manifest-dependency,
|
||||
missing-newline-extrafiles,
|
||||
missing-readme,
|
||||
no-utf8-coding-comment,
|
||||
odoo-addons-relative-import,
|
||||
old-api7-method-defined,
|
||||
unnecessary-utf8-coding-comment,
|
||||
# messages that do not cause the lint step to fail
|
||||
consider-merging-classes-inherited,
|
||||
deprecated-module,
|
||||
invalid-commit,
|
||||
missing-readme,
|
||||
odoo-addons-relative-import,
|
||||
redefined-builtin,
|
||||
too-complex,
|
||||
unnecessary-utf8-coding-comment
|
||||
manifest-external-assets
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
@@ -9,7 +9,7 @@ manifest-required-authors=Elabore
|
||||
manifest-required-keys=license
|
||||
manifest-deprecated-keys=description,active
|
||||
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
||||
valid-odoo-versions=16.0
|
||||
valid-odoo-versions=18.0
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=all
|
||||
@@ -17,19 +17,25 @@ disable=all
|
||||
enable=anomalous-backslash-in-string,
|
||||
api-one-deprecated,
|
||||
api-one-multi-together,
|
||||
assignment-from-none,
|
||||
attribute-deprecated,
|
||||
class-camelcase,
|
||||
dangerous-default-value,
|
||||
dangerous-view-replace-wo-priority,
|
||||
development-status-allowed,
|
||||
duplicate-id-csv,
|
||||
duplicate-key,
|
||||
duplicate-xml-fields,
|
||||
duplicate-xml-record-id,
|
||||
eval-referenced,
|
||||
eval-used,
|
||||
incoherent-interpreter-exec-perm,
|
||||
openerp-exception-warning,
|
||||
redundant-modulename-xml,
|
||||
relative-import,
|
||||
rst-syntax-error,
|
||||
wrong-tabs-instead-of-spaces,
|
||||
xml-syntax-error,
|
||||
assignment-from-none,
|
||||
attribute-deprecated,
|
||||
dangerous-default-value,
|
||||
development-status-allowed,
|
||||
duplicate-key,
|
||||
eval-used,
|
||||
license-allowed,
|
||||
manifest-author-string,
|
||||
manifest-deprecated-key,
|
||||
@@ -40,56 +46,50 @@ enable=anomalous-backslash-in-string,
|
||||
method-inverse,
|
||||
method-required-super,
|
||||
method-search,
|
||||
openerp-exception-warning,
|
||||
pointless-statement,
|
||||
pointless-string-statement,
|
||||
print-used,
|
||||
redundant-keyword-arg,
|
||||
redundant-modulename-xml,
|
||||
reimported,
|
||||
relative-import,
|
||||
return-in-init,
|
||||
rst-syntax-error,
|
||||
sql-injection,
|
||||
too-few-format-args,
|
||||
translation-field,
|
||||
translation-required,
|
||||
unreachable,
|
||||
use-vim-comment,
|
||||
wrong-tabs-instead-of-spaces,
|
||||
xml-syntax-error,
|
||||
attribute-string-redundant,
|
||||
character-not-valid-in-resource-link,
|
||||
consider-merging-classes-inherited,
|
||||
context-overridden,
|
||||
create-user-wo-reset-password,
|
||||
dangerous-filter-wo-user,
|
||||
dangerous-qweb-replace-wo-priority,
|
||||
deprecated-data-xml-node,
|
||||
deprecated-openerp-xml-node,
|
||||
duplicate-po-message-definition,
|
||||
except-pass,
|
||||
file-not-used,
|
||||
invalid-commit,
|
||||
manifest-maintainers-list,
|
||||
missing-newline-extrafiles,
|
||||
missing-readme,
|
||||
missing-return,
|
||||
odoo-addons-relative-import,
|
||||
old-api7-method-defined,
|
||||
po-msgstr-variables,
|
||||
po-syntax-error,
|
||||
renamed-field-parameter,
|
||||
resource-not-exist,
|
||||
str-format-used,
|
||||
test-folder-imported,
|
||||
translation-contains-variable,
|
||||
translation-positional-used,
|
||||
unnecessary-utf8-coding-comment,
|
||||
website-manifest-key-not-valid-uri,
|
||||
xml-attribute-translatable,
|
||||
xml-deprecated-qweb-directive,
|
||||
xml-deprecated-tree-attribute,
|
||||
attribute-string-redundant,
|
||||
consider-merging-classes-inherited,
|
||||
context-overridden,
|
||||
except-pass,
|
||||
invalid-commit,
|
||||
manifest-maintainers-list,
|
||||
missing-readme,
|
||||
missing-return,
|
||||
odoo-addons-relative-import,
|
||||
renamed-field-parameter,
|
||||
resource-not-exist,
|
||||
test-folder-imported,
|
||||
translation-contains-variable,
|
||||
translation-positional-used,
|
||||
website-manifest-key-not-valid-uri,
|
||||
external-request-timeout
|
||||
|
||||
[REPORTS]
|
||||
|
||||
@@ -3,27 +3,21 @@
|
||||
|
||||
{
|
||||
"name": "account_advanced_protection_features",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"maintainer": "Quentin Mondot",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
"summary": "Add several protection features about accounting",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"base",
|
||||
"account"
|
||||
],
|
||||
"depends": ["base", "account"],
|
||||
"qweb": [],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
"security/res_groups.xml",
|
||||
"views/account_journal_views.xml"
|
||||
],
|
||||
"data": ["security/res_groups.xml", "views/account_journal_views.xml"],
|
||||
# only loaded in demonstration mode
|
||||
"demo": [],
|
||||
"js": [],
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-08-29 08:28+0000\n"
|
||||
"PO-Revision-Date: 2025-08-29 08:28+0000\n"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from odoo import models, _
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
_inherit = "account.bank.statement"
|
||||
|
||||
@@ -8,12 +9,16 @@ class AccountBankStatement(models.Model):
|
||||
for statement in self:
|
||||
if not statement.journal_id.allow_bank_statement_deletion:
|
||||
raise UserError(
|
||||
_("The deletion of bank statements is not allowed for the journal %s.") % statement.journal_id.display_name
|
||||
_(
|
||||
"The deletion of bank statements is "
|
||||
"not allowed for the journal %s."
|
||||
)
|
||||
% statement.journal_id.display_name
|
||||
)
|
||||
# we delete all the statement lines before deleting the statement itself
|
||||
for line in statement.line_ids:
|
||||
line.unlink()
|
||||
return super(AccountBankStatement, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
|
||||
class AccountBankStatementLine(models.Model):
|
||||
@@ -23,6 +28,10 @@ class AccountBankStatementLine(models.Model):
|
||||
for line in self:
|
||||
if not line.journal_id.allow_bank_statement_deletion:
|
||||
raise UserError(
|
||||
_("The deletion of bank statement lines is not allowed for the journal %s.") % line.journal_id.display_name
|
||||
_(
|
||||
"The deletion of bank statement lines is "
|
||||
"not allowed for the journal %s."
|
||||
)
|
||||
% line.journal_id.display_name
|
||||
)
|
||||
return super(AccountBankStatementLine, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = "account.journal"
|
||||
|
||||
prevent_reset_to_draft_sent_invoice = fields.Boolean("Prevent to reset to draft a sent invoice")
|
||||
prevent_deletion_of_posted_account_move = fields.Boolean("Prevent to delete an already posted account move")
|
||||
prevent_reset_to_draft_sent_invoice = fields.Boolean(
|
||||
"Prevent to reset to draft a sent invoice"
|
||||
)
|
||||
prevent_deletion_of_posted_account_move = fields.Boolean(
|
||||
"Prevent to delete an already posted account move"
|
||||
)
|
||||
allow_bank_statement_deletion = fields.Boolean(
|
||||
"Allow bank statements deletion",
|
||||
help="Users with group Show Full Accounting Features (id: group_account_user) will be allowed to delete account bank statements "
|
||||
"and bank statement lines."
|
||||
help="Users with group Show Full Accounting Features (id: group_account_user) "
|
||||
"will be allowed to delete account bank statements "
|
||||
"and bank statement lines.",
|
||||
)
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
from odoo import models, api, fields, _
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
_inherit = "account.move"
|
||||
|
||||
def button_draft(self):
|
||||
if self.is_move_sent and self.journal_id.prevent_reset_to_draft_sent_invoice:
|
||||
raise UserError(_(
|
||||
"You cannot reset to draft this invoice because it has been sent by email."
|
||||
))
|
||||
return super(AccountMove, self).button_draft()
|
||||
raise UserError(
|
||||
_(
|
||||
"You cannot reset to draft this invoice because it "
|
||||
"has been sent by email."
|
||||
)
|
||||
)
|
||||
return super().button_draft()
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _check_posted(self):
|
||||
""" Prevent deletion of an account move if it has already been posted and
|
||||
journal parameter prevent_deletion_of_posted_account_move is activated
|
||||
"""
|
||||
Prevent deletion of an account move if it has already been posted and journal
|
||||
parameter prevent_deletion_of_posted_account_move is activated.
|
||||
"""
|
||||
for rec in self:
|
||||
if rec.posted_before and rec.journal_id.prevent_deletion_of_posted_account_move:
|
||||
raise UserError(_(
|
||||
"You cannot delete this account move because it has already been posted."
|
||||
))
|
||||
if (
|
||||
rec.posted_before
|
||||
and rec.journal_id.prevent_deletion_of_posted_account_move
|
||||
):
|
||||
raise UserError(
|
||||
_(
|
||||
"You cannot delete this account move because it "
|
||||
"has already been posted."
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="group_account_protection_manager" model="res.groups">
|
||||
<field name="name">Access to account advanced protection features</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
<field name="category_id" ref="base.module_category_hidden" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_account_journal_form_inherit_prevent_reset_to_draft" model="ir.ui.view">
|
||||
<record
|
||||
id="view_account_journal_form_inherit_prevent_reset_to_draft"
|
||||
model="ir.ui.view"
|
||||
>
|
||||
<field name="name">account.journal.form</field>
|
||||
<field name="model">account.journal</field>
|
||||
<field name="inherit_id" ref="account.view_account_journal_form"/>
|
||||
<field name="inherit_id" ref="account.view_account_journal_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='restrict_mode_hash_table']" position="after">
|
||||
<field
|
||||
name="prevent_deletion_of_posted_account_move"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
name="prevent_deletion_of_posted_account_move"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
/>
|
||||
<field
|
||||
name="prevent_reset_to_draft_sent_invoice"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
attrs="{'invisible': [('type', '!=', 'sale')]}"
|
||||
name="prevent_reset_to_draft_sent_invoice"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
invisible="type != 'sale'"
|
||||
/>
|
||||
<field
|
||||
name="allow_bank_statement_deletion"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"
|
||||
name="allow_bank_statement_deletion"
|
||||
groups="account_advanced_protection_features.group_account_protection_manager"
|
||||
invisible="type not in ['bank', 'cash']"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
32
account_chorus_notify/README.md
Normal file
32
account_chorus_notify/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# account_chorus_notify
|
||||
|
||||
Posts a notification on supplier invoices when their Chorus flow is rejected.
|
||||
|
||||
Override of `chorus.flow.update_flow_status()`: when a flow status becomes `IN_REJETE`, a message is posted on each related invoice (`invoice_ids`) with the flow reference.
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure `l10n_fr_chorus_account` is available, then use the standard Odoo module installation procedure to install `account_chorus_notify`.
|
||||
|
||||
## Known issues / Roadmap
|
||||
|
||||
None yet.
|
||||
|
||||
## Bug Tracker
|
||||
|
||||
Bugs are tracked on [our issues website](https://github.com/elabore-coop/account-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
|
||||
|
||||
* Stéphan Sainléger - [Github](https://github.com/stephansainleger)
|
||||
|
||||
### Funders
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* [Elabore](https://elabore.coop)
|
||||
|
||||
### Maintainer
|
||||
|
||||
This module is maintained by Elabore.
|
||||
2
account_chorus_notify/__init__.py
Normal file
2
account_chorus_notify/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
from . import models
|
||||
75
account_chorus_notify/__manifest__.py
Normal file
75
account_chorus_notify/__manifest__.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# Copyright 2021 Elabore ()
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "account_chorus_notify",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"maintainer": "False",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"category": "False",
|
||||
"summary": "Send notification when chorus invoice failed",
|
||||
"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
|
||||
=======================
|
||||
Account Chorus Notify
|
||||
=======================
|
||||
Send notification when chorus invoice failed
|
||||
|
||||
Installation
|
||||
============
|
||||
Just install account_chorus_notify, all dependencies will be installed by default.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/elabore-coop/elabore-odoo-addons/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>`_.
|
||||
|
||||
|
||||
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": [
|
||||
"l10n_fr_chorus_account",
|
||||
],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
"demo": [],
|
||||
"js": [],
|
||||
"css": [],
|
||||
"qweb": [],
|
||||
"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,
|
||||
}
|
||||
2
account_chorus_notify/models/__init__.py
Normal file
2
account_chorus_notify/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
from . import chorus_flow
|
||||
14
account_chorus_notify/models/chorus_flow.py
Normal file
14
account_chorus_notify/models/chorus_flow.py
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class ChorusFlow(models.Model):
|
||||
_inherit = "chorus.flow"
|
||||
|
||||
def update_flow_status(self):
|
||||
res = super(ChorusFlow, self).update_flow_status()
|
||||
for flow in self:
|
||||
if flow.status == 'IN_REJETE':
|
||||
for invoice in flow.invoice_ids:
|
||||
invoice.message_post(body=_("Chorus flow n°%s rejected.")%(flow.name,))
|
||||
return res
|
||||
1
account_chorus_notify/tests/__init__.py
Normal file
1
account_chorus_notify/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_chorus_notify
|
||||
100
account_chorus_notify/tests/test_chorus_notify.py
Normal file
100
account_chorus_notify/tests/test_chorus_notify.py
Normal file
@@ -0,0 +1,100 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import Command, fields
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestChorusNotify(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
||||
cls.company = cls.env.ref('base.main_company')
|
||||
cls.partner = cls.env['res.partner'].create({
|
||||
'name': 'Test Vendor',
|
||||
'company_id': cls.company.id,
|
||||
})
|
||||
|
||||
cls.expense_account = cls.env['account.account'].create({
|
||||
'code': '6TEST001',
|
||||
'name': 'Test Expense',
|
||||
'account_type': 'expense',
|
||||
})
|
||||
|
||||
cls.journal = cls.env['account.journal'].create({
|
||||
'name': 'Test Purchase',
|
||||
'type': 'purchase',
|
||||
'code': 'PURCH',
|
||||
})
|
||||
|
||||
cls.flow = cls.env['chorus.flow'].create({
|
||||
'name': 'TEST-FLOW-001',
|
||||
'date': fields.Date.today(),
|
||||
'company_id': cls.company.id,
|
||||
})
|
||||
|
||||
cls.invoice = cls.env['account.move'].create({
|
||||
'move_type': 'in_invoice',
|
||||
'journal_id': cls.journal.id,
|
||||
'partner_id': cls.partner.id,
|
||||
'invoice_date': fields.Date.today(),
|
||||
'chorus_flow_id': cls.flow.id,
|
||||
'invoice_line_ids': [Command.create({
|
||||
'name': 'Test line',
|
||||
'price_unit': 100,
|
||||
'quantity': 1,
|
||||
'account_id': cls.expense_account.id,
|
||||
})],
|
||||
})
|
||||
|
||||
def _patch_chorus_api(self, status):
|
||||
self.patch(
|
||||
type(self.env['res.company']),
|
||||
'_chorus_get_api_params',
|
||||
lambda self, raise_if_ko=True: {'dummy': True},
|
||||
)
|
||||
self.patch(
|
||||
type(self.env['chorus.flow']),
|
||||
'_chorus_api_consulter_cr',
|
||||
lambda self, api_params, session=None: (
|
||||
{'status': status, 'notes': ''}, session,
|
||||
),
|
||||
)
|
||||
|
||||
def _assert_rejection_message(self, invoice, flow_name, expected=True):
|
||||
messages = invoice.message_ids.filtered(
|
||||
lambda m: 'Chorus flow n°%s rejected.' % flow_name in (m.body or '')
|
||||
)
|
||||
if expected:
|
||||
self.assertTrue(
|
||||
messages,
|
||||
"A rejection message should be posted on invoice %s" % invoice.name,
|
||||
)
|
||||
else:
|
||||
self.assertFalse(
|
||||
messages,
|
||||
"No rejection message expected on invoice %s" % invoice.name,
|
||||
)
|
||||
|
||||
def test_flow_rejected_notifies_invoice(self):
|
||||
self._patch_chorus_api('IN_REJETE')
|
||||
self.flow.update_flow_status()
|
||||
self.assertEqual(self.flow.status, 'IN_REJETE')
|
||||
self._assert_rejection_message(self.invoice, 'TEST-FLOW-001')
|
||||
|
||||
def test_flow_accepted_does_not_notify(self):
|
||||
self._patch_chorus_api('IN_INTEGRE')
|
||||
self.flow.update_flow_status()
|
||||
self.assertEqual(self.flow.status, 'IN_INTEGRE')
|
||||
self._assert_rejection_message(self.invoice, 'TEST-FLOW-001', expected=False)
|
||||
|
||||
def test_flow_rejected_no_invoices(self):
|
||||
flow2 = self.env['chorus.flow'].create({
|
||||
'name': 'TEST-FLOW-002',
|
||||
'date': fields.Date.today(),
|
||||
'company_id': self.company.id,
|
||||
})
|
||||
self._patch_chorus_api('IN_REJETE')
|
||||
flow2.update_flow_status()
|
||||
self.assertEqual(flow2.status, 'IN_REJETE')
|
||||
125
account_invoice_default_journal/README.md
Normal file
125
account_invoice_default_journal/README.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# account_invoice_default_journal
|
||||
|
||||
Forces the journal of an invoice from a journal configured on its products.
|
||||
|
||||
Two company-dependent journal fields are added on the product form, under the
|
||||
**Accounting** tab:
|
||||
|
||||
- `forced_journal_id` ("Forced sale journal", restricted to sale journals), used for
|
||||
customer invoices and credit notes (`out_invoice`, `out_refund`).
|
||||
- `forced_purchase_journal_id` ("Forced purchase journal", restricted to purchase
|
||||
journals), used for vendor bills and refunds (`in_invoice`, `in_refund`).
|
||||
|
||||
When Odoo looks for the default journal of an invoice
|
||||
(`account.move._search_default_journal()`), the journal forced by the invoice lines'
|
||||
products takes precedence over the company default. A move belongs to a single journal,
|
||||
so a `UserError` is raised if the lines force two different journals — split the
|
||||
document into two invoices in that case.
|
||||
|
||||
Both fields are company-dependent: each company configures its own forced journal on the
|
||||
same product.
|
||||
|
||||
## Installation
|
||||
|
||||
`account` is the only dependency, and it is part of Odoo core. Use the standard Odoo
|
||||
module installation procedure to install `account_invoice_default_journal`.
|
||||
|
||||
### Required access group
|
||||
|
||||
Both fields are added inside the **Accounting** tab of the product form, which comes
|
||||
from `account.product_template_form_view`. In Odoo 18.0 that tab is restricted to the
|
||||
technical group `account.group_account_readonly`, and neither
|
||||
`account.group_account_invoice` ("Invoicing") nor `account.group_account_manager`
|
||||
("Administrator") implies it — only `account.group_account_user` ("Show Full Accounting
|
||||
Features") does. Odoo 16.0 also allowed `account.group_account_invoice` on that tab, so
|
||||
the restriction is tighter than it used to be.
|
||||
|
||||
On an Invoicing-only installation, meaning without the `account_accountant` module,
|
||||
there is no standard way to obtain that group: it has to be granted explicitly.
|
||||
Otherwise both fields stay invisible even though the module is correctly installed.
|
||||
|
||||
Upgrading an Odoo 16.0 database: the values of both fields were stored in `ir.property`,
|
||||
a model removed in Odoo 17.0. The module ships
|
||||
`migrations/18.0.1.0.0/post-migration.py`, which converts them to the new `jsonb`
|
||||
storage automatically during the upgrade.
|
||||
|
||||
## Configuration
|
||||
|
||||
No configuration is needed. Set the journal on each product that needs one; a product
|
||||
with no forced journal does not affect journal selection.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Open the product form and go to the **Accounting** tab.
|
||||
2. Set **Forced sale journal** and/or **Forced purchase journal**.
|
||||
|
||||
The forced journal is then applied when Odoo computes the journal of a new invoice,
|
||||
which happens only if the invoice is created together with its lines **and** without an
|
||||
explicit journal in the creation values. That is the case for invoices generated from
|
||||
another document, such as a sale order.
|
||||
|
||||
It is **not** the case when editing an invoice in the user interface: see the limitation
|
||||
below. Read it before relying on this module for manual invoicing.
|
||||
|
||||
## Known issues / Roadmap
|
||||
|
||||
### The forced journal is a default, not a constraint
|
||||
|
||||
The module plugs into `account.move._search_default_journal()`, which supplies a
|
||||
**default** value. A default is overridable by design, so the forced journal is only
|
||||
honored on one of the three ways an invoice can get its journal:
|
||||
|
||||
- Created in a single call, with its lines, and no `journal_id` in the creation values:
|
||||
the forced journal **is** applied.
|
||||
- Created in a single call with an explicit `journal_id` in the creation values: the
|
||||
forced journal is **not** applied.
|
||||
- Created first, then lines added afterwards: the forced journal is **not** applied.
|
||||
|
||||
Two independent Odoo behaviors cause the two failing cases:
|
||||
|
||||
- An explicit value in the creation values short-circuits the computation entirely, so
|
||||
the default is never requested. The web client sends `journal_id` because the field is
|
||||
present and editable in the invoice form, which puts manual invoicing in this case.
|
||||
- `_compute_journal_id` declares
|
||||
`@api.depends('move_type', 'origin_payment_id', 'statement_line_id')`. It does not
|
||||
depend on `invoice_line_ids`, so adding a product never invalidates the journal. It
|
||||
also skips any move whose journal already has a valid type, which is true of the
|
||||
company default sale journal.
|
||||
|
||||
Both behaviors are identical in Odoo 16.0, so this is a limitation of the module's
|
||||
design rather than a regression introduced by the 18.0 migration.
|
||||
|
||||
Lifting it means moving from a default to an actual constraint, by overriding `create`
|
||||
and `write`, or by refusing to save a mismatched journal. Both change behavior for
|
||||
existing users and neither is implemented.
|
||||
|
||||
### Other
|
||||
|
||||
- `_search_default_journal()` calls `super()` first, so a company with no journal of the
|
||||
expected type still raises before the forced journal is considered.
|
||||
|
||||
## Bug Tracker
|
||||
|
||||
Bugs are tracked on
|
||||
[our issues website](https://github.com/elabore-coop/account-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
|
||||
|
||||
- Stéphan SAINLEGER - [Github](https://github.com/stephansainleger)
|
||||
- Nicolas JEUDY - [Github](https://github.com/njeudy)
|
||||
|
||||
### Funders
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
|
||||
- [Lokavaluto](https://lokavaluto.fr)
|
||||
- [Mycéliandre](https://myceliandre.fr)
|
||||
- [Elabore](https://elabore.coop)
|
||||
|
||||
### Maintainer
|
||||
|
||||
This module is maintained by Elabore.
|
||||
22
account_invoice_default_journal/__manifest__.py
Normal file
22
account_invoice_default_journal/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Copyright 2022 Nicolas JEUDY
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Account Invoice Default Journal",
|
||||
"version": "18.0.1.0.0",
|
||||
"category": "Accounting",
|
||||
"summary": "Force the invoice journal from a journal set on the product",
|
||||
"author": "Nicolas JEUDY, Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"account",
|
||||
],
|
||||
"data": [
|
||||
"views/product_template_view.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
64
account_invoice_default_journal/i18n/fr.po
Normal file
64
account_invoice_default_journal/i18n/fr.po
Normal file
@@ -0,0 +1,64 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_default_journal
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-20 15:05+0000\n"
|
||||
"PO-Revision-Date: 2026-10-20 15:05+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model.fields,field_description:account_invoice_default_journal.field_product_product__forced_purchase_journal_id
|
||||
#: model:ir.model.fields,field_description:account_invoice_default_journal.field_product_template__forced_purchase_journal_id
|
||||
msgid "Forced purchase journal"
|
||||
msgstr "Forcer le journal d'achat"
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model.fields,field_description:account_invoice_default_journal.field_product_product__forced_journal_id
|
||||
#: model:ir.model.fields,field_description:account_invoice_default_journal.field_product_template__forced_journal_id
|
||||
msgid "Forced sale journal"
|
||||
msgstr "Forcer le journal de vente"
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model,name:account_invoice_default_journal.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "Pièce comptable"
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model.fields,help:account_invoice_default_journal.field_product_product__forced_journal_id
|
||||
#: model:ir.model.fields,help:account_invoice_default_journal.field_product_template__forced_journal_id
|
||||
msgid ""
|
||||
"Journal to use on customer invoices containing this product, instead of the "
|
||||
"company default sale journal."
|
||||
msgstr ""
|
||||
"Journal à utiliser sur les factures client contenant cet article, à la place "
|
||||
"du journal de vente par défaut de la société."
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model.fields,help:account_invoice_default_journal.field_product_product__forced_purchase_journal_id
|
||||
#: model:ir.model.fields,help:account_invoice_default_journal.field_product_template__forced_purchase_journal_id
|
||||
msgid ""
|
||||
"Journal to use on vendor bills containing this product, instead of the "
|
||||
"company default purchase journal."
|
||||
msgstr ""
|
||||
"Journal à utiliser sur les factures fournisseur contenant cet article, à la "
|
||||
"place du journal d'achat par défaut de la société."
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#: model:ir.model,name:account_invoice_default_journal.model_product_template
|
||||
msgid "Product"
|
||||
msgstr "Produit"
|
||||
|
||||
#. module: account_invoice_default_journal
|
||||
#. odoo-python
|
||||
#: code:addons/account_invoice_default_journal/models/account_move.py:0
|
||||
msgid "You can not have 2 forced journals on the same invoice !"
|
||||
msgstr "Vous ne pouvez pas avoir 2 journaux forcés sur la même facture !"
|
||||
@@ -0,0 +1,198 @@
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
"""
|
||||
Carry 16.0 ``ir.property`` values over to the 18.0 ``jsonb`` storage.
|
||||
|
||||
Odoo 17.0 removed the ``ir.property`` model: the value of a
|
||||
``company_dependent`` field now lives in a ``jsonb`` column on the model's own
|
||||
table, keyed by company id, with the cross-record fallback stored in
|
||||
``ir.default``. Nothing converts the values of a *custom* company-dependent
|
||||
field automatically, so a 16.0 database upgraded to 18.0 would silently lose
|
||||
every forced journal configured on a product.
|
||||
|
||||
This script reads the legacy ``ir_property`` rows of the two fields this module
|
||||
owns and rewrites them in the 18.0 format. It is idempotent and a no-op on a
|
||||
fresh 18.0 install, where the ``ir_property`` table no longer exists.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
MODEL = "product.template"
|
||||
TABLE = "product_template"
|
||||
FIELDS = ("forced_journal_id", "forced_purchase_journal_id")
|
||||
|
||||
|
||||
def _legacy_table_exists(cr):
|
||||
"""
|
||||
Tell whether the 16.0 ``ir_property`` table is still present.
|
||||
|
||||
:param cr: database cursor.
|
||||
:return: ``True`` when the legacy table can be read, ``False`` on a fresh
|
||||
18.0 install or once the table has been dropped.
|
||||
"""
|
||||
cr.execute("SELECT to_regclass('public.ir_property') IS NOT NULL")
|
||||
return cr.fetchone()[0]
|
||||
|
||||
|
||||
def _field_id(cr, field_name):
|
||||
"""
|
||||
Return the ``ir_model_fields`` id of a field of :data:`MODEL`.
|
||||
|
||||
Only the ``product.template`` definition is looked up on purpose: the
|
||||
``product.product`` counterpart is a delegated related field and never
|
||||
carries ``ir.property`` rows of its own.
|
||||
|
||||
:param cr: database cursor.
|
||||
:param str field_name: name of the field to look up.
|
||||
:return: the field id, or ``None`` when the field is unknown to the
|
||||
database (module never installed before the upgrade).
|
||||
"""
|
||||
cr.execute(
|
||||
"SELECT id FROM ir_model_fields WHERE model = %s AND name = %s",
|
||||
(MODEL, field_name),
|
||||
)
|
||||
row = cr.fetchone()
|
||||
return row[0] if row else None
|
||||
|
||||
|
||||
def _migrate_per_record_values(cr, field_name, field_id):
|
||||
"""
|
||||
Move per-product legacy values into the ``jsonb`` column.
|
||||
|
||||
Existing keys in the target column win, which makes the operation
|
||||
idempotent and safe to re-run after a partial upgrade. Properties pointing
|
||||
at a journal that no longer exists are dropped, since the ``jsonb``
|
||||
storage of a company-dependent many2one has no foreign key to protect it.
|
||||
|
||||
:param cr: database cursor.
|
||||
:param str field_name: name of the company-dependent field to fill.
|
||||
:param int field_id: ``ir_model_fields`` id of that field.
|
||||
:return: number of products updated.
|
||||
"""
|
||||
cr.execute(
|
||||
f"""
|
||||
WITH legacy AS (
|
||||
SELECT
|
||||
split_part(ip.res_id, ',', 2)::integer AS product_tmpl_id,
|
||||
ip.company_id AS company_id,
|
||||
split_part(ip.value_reference, ',', 2)::integer AS journal_id
|
||||
FROM ir_property ip
|
||||
WHERE ip.fields_id = %s
|
||||
AND ip.type = 'many2one'
|
||||
AND ip.value_reference IS NOT NULL
|
||||
AND ip.res_id IS NOT NULL
|
||||
AND ip.company_id IS NOT NULL
|
||||
AND split_part(ip.res_id, ',', 1) = %s
|
||||
),
|
||||
checked AS (
|
||||
SELECT legacy.*
|
||||
FROM legacy
|
||||
JOIN account_journal aj ON aj.id = legacy.journal_id
|
||||
JOIN {TABLE} pt ON pt.id = legacy.product_tmpl_id
|
||||
JOIN res_company rc ON rc.id = legacy.company_id
|
||||
),
|
||||
grouped AS (
|
||||
SELECT
|
||||
product_tmpl_id,
|
||||
jsonb_object_agg(company_id::text, journal_id) AS value
|
||||
FROM checked
|
||||
GROUP BY product_tmpl_id
|
||||
)
|
||||
UPDATE {TABLE} pt
|
||||
SET {field_name} = grouped.value || COALESCE(pt.{field_name}, '{{}}'::jsonb)
|
||||
FROM grouped
|
||||
WHERE pt.id = grouped.product_tmpl_id
|
||||
""",
|
||||
(field_id, MODEL),
|
||||
)
|
||||
return cr.rowcount
|
||||
|
||||
|
||||
def _migrate_fallback_values(cr, field_name, field_id):
|
||||
"""
|
||||
Move legacy cross-record defaults into ``ir_default``.
|
||||
|
||||
An ``ir_property`` row without ``res_id`` was a default applying to every
|
||||
record of the model. In 18.0 that role belongs to ``ir.default``, which is
|
||||
what :meth:`odoo.fields.Field.get_company_dependent_fallback` reads.
|
||||
|
||||
Rows are only inserted when no default exists yet for the same field and
|
||||
company, keeping the operation idempotent.
|
||||
|
||||
:param cr: database cursor.
|
||||
:param str field_name: name of the company-dependent field.
|
||||
:param int field_id: ``ir_model_fields`` id of that field.
|
||||
:return: number of defaults created.
|
||||
"""
|
||||
cr.execute(
|
||||
"""
|
||||
INSERT INTO ir_default (field_id, user_id, company_id, condition, json_value)
|
||||
SELECT %s, NULL, ip.company_id, NULL,
|
||||
split_part(ip.value_reference, ',', 2)
|
||||
FROM ir_property ip
|
||||
JOIN account_journal aj
|
||||
ON aj.id = split_part(ip.value_reference, ',', 2)::integer
|
||||
JOIN res_company rc ON rc.id = ip.company_id
|
||||
WHERE ip.fields_id = %s
|
||||
AND ip.type = 'many2one'
|
||||
AND ip.value_reference IS NOT NULL
|
||||
AND ip.res_id IS NULL
|
||||
AND ip.company_id IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM ir_default d
|
||||
WHERE d.field_id = %s
|
||||
AND d.company_id = ip.company_id
|
||||
AND d.user_id IS NULL
|
||||
AND d.condition IS NULL
|
||||
)
|
||||
""",
|
||||
(field_id, field_id, field_id),
|
||||
)
|
||||
if cr.rowcount:
|
||||
_logger.info(
|
||||
"%s: converted %s company fallback(s) from ir.property to ir.default",
|
||||
field_name,
|
||||
cr.rowcount,
|
||||
)
|
||||
return cr.rowcount
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
"""
|
||||
Convert the module's legacy ``ir.property`` rows to the 18.0 storage.
|
||||
|
||||
Runs after the module schema has been updated, so the ``jsonb`` columns
|
||||
this script writes into already exist.
|
||||
|
||||
:param cr: database cursor.
|
||||
:param str version: version the module is upgraded from. Falsy on a fresh
|
||||
install, in which case there is nothing to convert.
|
||||
"""
|
||||
if not version:
|
||||
return
|
||||
if not _legacy_table_exists(cr):
|
||||
_logger.info(
|
||||
"ir_property table is gone, nothing to convert for %s",
|
||||
", ".join(FIELDS),
|
||||
)
|
||||
return
|
||||
|
||||
for field_name in FIELDS:
|
||||
field_id = _field_id(cr, field_name)
|
||||
if not field_id:
|
||||
_logger.warning(
|
||||
"%s.%s not found in ir_model_fields, skipping its conversion",
|
||||
MODEL,
|
||||
field_name,
|
||||
)
|
||||
continue
|
||||
updated = _migrate_per_record_values(cr, field_name, field_id)
|
||||
_migrate_fallback_values(cr, field_name, field_id)
|
||||
_logger.info(
|
||||
"%s.%s: %s product(s) migrated from ir.property to jsonb storage",
|
||||
MODEL,
|
||||
field_name,
|
||||
updated,
|
||||
)
|
||||
2
account_invoice_default_journal/models/__init__.py
Normal file
2
account_invoice_default_journal/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import product_template
|
||||
from . import account_move
|
||||
64
account_invoice_default_journal/models/account_move.py
Normal file
64
account_invoice_default_journal/models/account_move.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# Copyright 2022 Nicolas JEUDY
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def _get_forced_journal(self):
|
||||
"""
|
||||
Return the journal forced by the products of this move.
|
||||
|
||||
The journal is read from the product of each invoice line:
|
||||
``forced_journal_id`` for customer documents, and
|
||||
``forced_purchase_journal_id`` for vendor documents. Products
|
||||
carrying no forced journal are ignored.
|
||||
|
||||
Only the first record of ``self`` is considered, mirroring the
|
||||
single-record call sites in ``_search_default_journal``.
|
||||
|
||||
:return: the single forced ``account.journal`` record when exactly one
|
||||
product forces a journal. Otherwise the move's current
|
||||
``journal_id``, which is also what non-invoice moves return. An
|
||||
empty ``account.journal`` recordset when ``self`` is empty.
|
||||
:raises UserError: if the lines force more than one distinct journal,
|
||||
since a move belongs to exactly one journal.
|
||||
"""
|
||||
journal_model = self.env["account.journal"]
|
||||
for record in self:
|
||||
if record.move_type in ("out_invoice", "out_refund"):
|
||||
forced_journals = record.invoice_line_ids.product_id.forced_journal_id
|
||||
elif record.move_type in ("in_invoice", "in_refund"):
|
||||
forced_journals = (
|
||||
record.invoice_line_ids.product_id.forced_purchase_journal_id
|
||||
)
|
||||
else:
|
||||
forced_journals = journal_model
|
||||
if len(forced_journals) > 1:
|
||||
raise UserError(
|
||||
_("You can not have 2 forced journals on the same invoice !")
|
||||
)
|
||||
if len(forced_journals) == 1:
|
||||
return forced_journals
|
||||
return record.journal_id
|
||||
return journal_model
|
||||
|
||||
def _search_default_journal(self):
|
||||
"""
|
||||
Prefer the journal forced by the move products over the default one.
|
||||
|
||||
Extends the standard journal lookup so that a journal configured on a
|
||||
product takes precedence. Falls back to the standard behavior when no
|
||||
product forces a journal.
|
||||
|
||||
:return: the ``account.journal`` record to default to.
|
||||
"""
|
||||
res = super()._search_default_journal()
|
||||
forced_journal = self._get_forced_journal()
|
||||
if forced_journal:
|
||||
return forced_journal
|
||||
return res
|
||||
28
account_invoice_default_journal/models/product_template.py
Normal file
28
account_invoice_default_journal/models/product_template.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright 2022 Nicolas JEUDY
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
forced_journal_id = fields.Many2one(
|
||||
"account.journal",
|
||||
company_dependent=True,
|
||||
check_company=True,
|
||||
string="Forced sale journal",
|
||||
domain="[('type', '=', 'sale')]",
|
||||
help="Journal to use on customer invoices containing this product, "
|
||||
"instead of the company default sale journal.",
|
||||
)
|
||||
forced_purchase_journal_id = fields.Many2one(
|
||||
"account.journal",
|
||||
company_dependent=True,
|
||||
check_company=True,
|
||||
string="Forced purchase journal",
|
||||
domain="[('type', '=', 'purchase')]",
|
||||
help="Journal to use on vendor bills containing this product, "
|
||||
"instead of the company default purchase journal.",
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2022 Nicolas JEUDY
|
||||
Copyright 2026 Elabore
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_product_template_forced_journal_form">
|
||||
<field name="name">product.template.forced_journal.form.inherit</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="account.product_template_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
No `domain` attribute here on purpose: a view-level domain
|
||||
overrides the one generated from the field definition, which
|
||||
already combines the journal type with the `check_company`
|
||||
company domain.
|
||||
-->
|
||||
<field name="property_account_income_id" position="after">
|
||||
<field name="forced_journal_id" />
|
||||
</field>
|
||||
<field name="property_account_expense_id" position="after">
|
||||
<field name="forced_purchase_journal_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
32
account_mooncard_receipt_lost_transfer/README.md
Normal file
32
account_mooncard_receipt_lost_transfer/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# account_mooncard_receipt_lost_transfer
|
||||
|
||||
Propagates the **Receipt Lost** value of Mooncard payment transactions (`newgen.payment.card.transaction`) onto the related invoices and account move lines.
|
||||
|
||||
Adds `receipt_lost` and `mooncard_record` boolean fields on `account.move` and `account.move.line`, and exposes them in the invoice and move line forms (only visible on records originating from a Mooncard transaction).
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure the addons of the [Odoo Mooncard Connector](https://github.com/akretion/odoo-mooncard-connector) repository (in particular `base_newgen_payment_card`) are available in your Odoo, then use the standard Odoo module installation procedure to install `account_mooncard_receipt_lost_transfer`.
|
||||
|
||||
## Known issues / Roadmap
|
||||
|
||||
None yet.
|
||||
|
||||
## Bug Tracker
|
||||
|
||||
Bugs are tracked on [our issues website](https://git.elabore.coop/Elabore/account-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
|
||||
|
||||
* Stéphan Sainléger - [Github](https://github.com/stephansainleger)
|
||||
|
||||
### Funders
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* [Elabore](https://elabore.coop)
|
||||
|
||||
### Maintainer
|
||||
|
||||
This module is maintained by Elabore.
|
||||
2
account_mooncard_receipt_lost_transfer/__init__.py
Normal file
2
account_mooncard_receipt_lost_transfer/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
from . import models
|
||||
21
account_mooncard_receipt_lost_transfer/__manifest__.py
Normal file
21
account_mooncard_receipt_lost_transfer/__manifest__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "Account Mooncard Receipt Lost Transfer",
|
||||
"category": "Account",
|
||||
"version": "18.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Transfer the Receipt Lost value in invoices and account move lines",
|
||||
"author": "Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"depends": [
|
||||
"base",
|
||||
"account",
|
||||
"base_newgen_payment_card",
|
||||
],
|
||||
"data": [
|
||||
"views/account_move_views.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
from . import account_move
|
||||
from . import newgen_payment_card_transaction
|
||||
@@ -0,0 +1,15 @@
|
||||
from odoo import fields, models, _
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True)
|
||||
mooncard_record = fields.Boolean(store=True)
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True)
|
||||
mooncard_record = fields.Boolean(store=True)
|
||||
@@ -0,0 +1,31 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class NewgenPaymentCardTransaction(models.Model):
|
||||
_inherit = "newgen.payment.card.transaction"
|
||||
|
||||
def process_line(self):
|
||||
res = super(NewgenPaymentCardTransaction, self).process_line()
|
||||
if res:
|
||||
for line in self:
|
||||
if line.invoice_id:
|
||||
line.invoice_id.receipt_lost = line.receipt_lost
|
||||
line.invoice_id.mooncard_record = True
|
||||
move_lines = line.invoice_id.line_ids
|
||||
for move_line in move_lines:
|
||||
move_line.receipt_lost = line.receipt_lost
|
||||
move_line.mooncard_record = True
|
||||
|
||||
return res
|
||||
|
||||
def generate_bank_journal_move(self):
|
||||
bank_move = super(
|
||||
NewgenPaymentCardTransaction, self
|
||||
).generate_bank_journal_move()
|
||||
if bank_move:
|
||||
bank_move.receipt_lost = self.receipt_lost
|
||||
bank_move.mooncard_record = True
|
||||
for line in bank_move.line_ids:
|
||||
line.receipt_lost = self.receipt_lost
|
||||
line.mooncard_record = True
|
||||
return bank_move
|
||||
1
account_mooncard_receipt_lost_transfer/tests/__init__.py
Normal file
1
account_mooncard_receipt_lost_transfer/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_receipt_lost_transfer
|
||||
@@ -0,0 +1,144 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields
|
||||
from odoo.tests.common import TransactionCase
|
||||
import random
|
||||
|
||||
|
||||
class TestReceiptLostTransfer(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
||||
cls.company = cls.env.ref('base.main_company')
|
||||
cls.euro = cls.env.ref('base.EUR')
|
||||
cls.country = cls.env.ref('base.fr')
|
||||
cls.company.write({
|
||||
'currency_id': cls.euro.id,
|
||||
'country_id': cls.country.id,
|
||||
})
|
||||
cls.card_bank_account = cls.env['account.account'].create({
|
||||
'code': '512199',
|
||||
'name': 'Card prepaid account',
|
||||
'account_type': 'asset_cash',
|
||||
})
|
||||
cls.expense_account = cls.env['account.account'].create({
|
||||
'code': '6TESTXXX',
|
||||
'name': 'Test Expense Account',
|
||||
'account_type': 'expense',
|
||||
})
|
||||
cls.card_bank_journal = cls.env['account.journal'].create({
|
||||
'type': 'bank',
|
||||
'name': 'Card Test',
|
||||
'code': 'CARD',
|
||||
'default_account_id': cls.card_bank_account.id,
|
||||
})
|
||||
cls.card = cls.env['newgen.payment.card'].create({
|
||||
'name': 'TESTCARD987',
|
||||
'code': 'TST',
|
||||
'company_id': cls.company.id,
|
||||
'journal_id': cls.card_bank_journal.id,
|
||||
})
|
||||
|
||||
def _create_transaction(self, values):
|
||||
defaults = {
|
||||
'company_id': self.company.id,
|
||||
'card_id': self.card.id,
|
||||
'date': fields.Datetime.now(),
|
||||
'currency_id': self.euro.id,
|
||||
'country_id': self.country.id,
|
||||
'unique_import_id': 'TEST%s' % random.randrange(100000000),
|
||||
'transaction_type': 'expense',
|
||||
'expense_account_id': self.expense_account.id,
|
||||
'description': 'Test transaction',
|
||||
'vendor': 'Test vendor',
|
||||
'vat_company_currency': 0,
|
||||
'vat_rate': 0,
|
||||
'total_company_currency': -100,
|
||||
'receipt_lost': True,
|
||||
}
|
||||
defaults.update(values)
|
||||
return self.env['newgen.payment.card.transaction'].create(defaults)
|
||||
|
||||
def _assert_receipt_lost(self, move, expected_receipt_lost):
|
||||
self.assertEqual(
|
||||
move.receipt_lost, expected_receipt_lost,
|
||||
"%s: wrong receipt_lost" % move._name)
|
||||
self.assertTrue(
|
||||
move.mooncard_record,
|
||||
"%s: mooncard_record should be True" % move._name)
|
||||
for line in move.line_ids:
|
||||
self.assertEqual(
|
||||
line.receipt_lost, expected_receipt_lost,
|
||||
"move line %s: wrong receipt_lost" % line.display_name)
|
||||
self.assertTrue(
|
||||
line.mooncard_record,
|
||||
"move line %s: mooncard_record should be True" % line.display_name)
|
||||
|
||||
def test_expense_receipt_lost_true(self):
|
||||
trans = self._create_transaction({
|
||||
'receipt_lost': True,
|
||||
})
|
||||
trans.process_line()
|
||||
self.assertEqual(trans.state, 'done')
|
||||
invoice = trans.invoice_id
|
||||
self.assertTrue(invoice, "Invoice should be generated")
|
||||
self._assert_receipt_lost(invoice, True)
|
||||
self._assert_receipt_lost(trans.bank_move_id, True)
|
||||
|
||||
def test_expense_receipt_lost_false(self):
|
||||
trans = self._create_transaction({
|
||||
'receipt_lost': False,
|
||||
})
|
||||
self.env['ir.attachment'].create({
|
||||
'name': 'test_receipt.pdf',
|
||||
'res_model': 'newgen.payment.card.transaction',
|
||||
'res_id': trans.id,
|
||||
'raw': b'test attachment content',
|
||||
})
|
||||
trans.process_line()
|
||||
self.assertEqual(trans.state, 'done')
|
||||
invoice = trans.invoice_id
|
||||
self.assertTrue(invoice, "Invoice should be generated")
|
||||
self._assert_receipt_lost(invoice, False)
|
||||
self._assert_receipt_lost(trans.bank_move_id, False)
|
||||
|
||||
def test_bank_move_only_receipt_lost_true(self):
|
||||
trans = self._create_transaction({
|
||||
'receipt_lost': True,
|
||||
'bank_move_only': True,
|
||||
})
|
||||
trans.process_line()
|
||||
self.assertEqual(trans.state, 'done')
|
||||
self.assertFalse(trans.invoice_id, "No invoice when bank_move_only")
|
||||
bank_move = trans.bank_move_id
|
||||
self.assertTrue(bank_move, "Bank move should be generated")
|
||||
self._assert_receipt_lost(bank_move, True)
|
||||
|
||||
def test_bank_move_only_receipt_lost_false(self):
|
||||
trans = self._create_transaction({
|
||||
'receipt_lost': False,
|
||||
'bank_move_only': True,
|
||||
})
|
||||
trans.process_line()
|
||||
self.assertEqual(trans.state, 'done')
|
||||
self.assertFalse(trans.invoice_id, "No invoice when bank_move_only")
|
||||
bank_move = trans.bank_move_id
|
||||
self.assertTrue(bank_move, "Bank move should be generated")
|
||||
self._assert_receipt_lost(bank_move, False)
|
||||
|
||||
def test_load_receipt_lost_true(self):
|
||||
self.company.transfer_account_id = self.card_bank_account.id
|
||||
trans = self._create_transaction({
|
||||
'transaction_type': 'load',
|
||||
'receipt_lost': True,
|
||||
'total_company_currency': 1000,
|
||||
'expense_account_id': False,
|
||||
})
|
||||
trans.process_line()
|
||||
self.assertEqual(trans.state, 'done')
|
||||
self.assertFalse(trans.invoice_id, "Load should not generate an invoice")
|
||||
bank_move = trans.bank_move_id
|
||||
self.assertTrue(bank_move, "Bank move should be generated")
|
||||
self._assert_receipt_lost(bank_move, True)
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_move_form_recipt_lost" model="ir.ui.view">
|
||||
<field name="name">view.move.form.receipt.lost</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<div name="journal_div" position="after">
|
||||
<field name="mooncard_record" invisible="1" />
|
||||
<field name="receipt_lost" invisible="not mooncard_record" />
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_line_form_recipt_lost" model="ir.ui.view">
|
||||
<field name="name">view.move.line.form.recipt.lost</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='analytic_distribution']/.." position="after">
|
||||
<group string="Mooncard" invisible="not mooncard_record">
|
||||
<field name="mooncard_record" invisible="1" />
|
||||
<field name="receipt_lost" invisible="not mooncard_record" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
32
account_move_attachement_zipped_download/README.md
Normal file
32
account_move_attachement_zipped_download/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# account_move_attachement_zipped_download
|
||||
|
||||
Extends the `attachment_zipped_download` module to the `account.move` model (invoices, credit notes, etc.).
|
||||
|
||||
Adds a **"Download attachments"** entry in the Actions menu of the account moves list view. When multiple records are selected, all their attachments are downloaded as a single ZIP archive.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the `attachment_zipped_download` module first, then use the standard Odoo module installation procedure to install `account_move_attachement_zipped_download`.
|
||||
|
||||
## Known issues / Roadmap
|
||||
|
||||
None yet.
|
||||
|
||||
## Bug Tracker
|
||||
|
||||
Bugs are tracked on [our issues website](https://github.com/elabore-coop/account-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
|
||||
|
||||
* Boris Gallet - [Email](mailto:boris.gallet@elabore.coop) - [Github](https://github.com/b0g)
|
||||
|
||||
### Funders
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* [Elabore](https://elabore.coop)
|
||||
|
||||
### Maintainer
|
||||
|
||||
This module is maintained by Elabore.
|
||||
@@ -1,44 +0,0 @@
|
||||
===============
|
||||
account_move_attachement_zipped_download
|
||||
===============
|
||||
|
||||
custom attachments zipped download for account_move model
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
``account_move_attachement_zipped_download``.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
None yet.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/account_move_attachement_zipped_download/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
|
||||
------------
|
||||
|
||||
* Boris Gallet - `Email<mailto:boris.gallet@elabore.coop>` - `Github<https://github.com/b0g>`
|
||||
|
||||
Funders
|
||||
-------
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by Elabore.
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
{
|
||||
"name": "account_move_attachement_zipped_download",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"maintainer": "Boris Gallet",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
|
||||
30
account_move_last_payment/README.md
Normal file
30
account_move_last_payment/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Account Move Last Payment
|
||||
|
||||
Expose on `account.move` the date of the most recent real payment reconciled with an
|
||||
invoice, as a stored, exportable field shown in the invoice list view.
|
||||
|
||||
## Features
|
||||
|
||||
- `last_payment_date` (Date): date of the most recent payment reconciled with the
|
||||
invoice — partial payments included.
|
||||
- Covers both Community reconciliation paths: explicit payment ("Register Payment"
|
||||
wizard) and direct bank statement reconciliation. Manual reconciliations without
|
||||
payment or statement line are ignored, as are exchange difference moves.
|
||||
- Recomputes automatically on reconcile / unreconcile and when a payment or statement
|
||||
line date changes.
|
||||
- The field is stored and displayed as an optional column of the invoice list view, so
|
||||
it is exportable.
|
||||
|
||||
## Installation
|
||||
|
||||
Depends on the `account` module only.
|
||||
|
||||
## Credits
|
||||
|
||||
### Contributors
|
||||
|
||||
- Elabore - Assisted by AI
|
||||
|
||||
### Maintainer
|
||||
|
||||
- Elabore
|
||||
1
account_move_last_payment/__init__.py
Normal file
1
account_move_last_payment/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
21
account_move_last_payment/__manifest__.py
Normal file
21
account_move_last_payment/__manifest__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Account Move Last Payment",
|
||||
"version": "18.0.1.0.0",
|
||||
"summary": "Last real payment date on invoices",
|
||||
"author": "Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"category": "Accounting",
|
||||
"depends": [
|
||||
"account",
|
||||
],
|
||||
"data": [
|
||||
"views/account_move_views.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
47
account_move_last_payment/i18n/account_move_last_payment.pot
Normal file
47
account_move_last_payment/i18n/account_move_last_payment.pot
Normal file
@@ -0,0 +1,47 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_move_last_payment
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-29 10:16+0000\n"
|
||||
"PO-Revision-Date: 2026-10-29 10:16+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,help:account_move_last_payment.field_account_bank_statement_line__last_payment_date
|
||||
#: model:ir.model.fields,help:account_move_last_payment.field_account_move__last_payment_date
|
||||
msgid ""
|
||||
"Date of the most recent payment reconciled with this invoice, whatever the "
|
||||
"reconciliation path (explicit payment or direct bank statement line "
|
||||
"reconciliation)."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model,name:account_move_last_payment.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_bank_statement_line__last_payment_date
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_move__last_payment_date
|
||||
msgid "Last Payment Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_bank_statement_line__preferred_payment_method_line_id
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_move__preferred_payment_method_line_id
|
||||
msgid "Planned Payment Method"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_move__smart_search
|
||||
msgid "Smart Search"
|
||||
msgstr ""
|
||||
45
account_move_last_payment/i18n/fr.po
Normal file
45
account_move_last_payment/i18n/fr.po
Normal file
@@ -0,0 +1,45 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_move_last_payment
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-29 10:16+0000\n"
|
||||
"PO-Revision-Date: 2026-10-29 10:16+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,help:account_move_last_payment.field_account_bank_statement_line__last_payment_date
|
||||
#: model:ir.model.fields,help:account_move_last_payment.field_account_move__last_payment_date
|
||||
msgid ""
|
||||
"Date of the most recent payment reconciled with this invoice, whatever the "
|
||||
"reconciliation path (explicit payment or direct bank statement line "
|
||||
"reconciliation)."
|
||||
msgstr ""
|
||||
"Date du paiement le plus récent lettré avec cette facture, quel que soit "
|
||||
"le chemin de lettrage (paiement explicite ou rapprochement direct d'une "
|
||||
"ligne de relevé bancaire)."
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model,name:account_move_last_payment.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "Écriture comptable"
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_bank_statement_line__last_payment_date
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_move__last_payment_date
|
||||
msgid "Last Payment Date"
|
||||
msgstr "Date du dernier paiement"
|
||||
|
||||
#. module: account_move_last_payment
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_bank_statement_line__preferred_payment_method_line_id
|
||||
#: model:ir.model.fields,field_description:account_move_last_payment.field_account_move__preferred_payment_method_line_id
|
||||
msgid "Planned Payment Method"
|
||||
msgstr "Mode de paiement"
|
||||
1
account_move_last_payment/models/__init__.py
Normal file
1
account_move_last_payment/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import account_move
|
||||
71
account_move_last_payment/models/account_move.py
Normal file
71
account_move_last_payment/models/account_move.py
Normal file
@@ -0,0 +1,71 @@
|
||||
# Copyright 2026 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
last_payment_date = fields.Date(
|
||||
compute="_compute_last_payment_date",
|
||||
store=True,
|
||||
copy=False,
|
||||
help="Date of the most recent payment reconciled with this "
|
||||
"invoice, whatever the reconciliation path (explicit payment "
|
||||
"or direct bank statement line reconciliation).",
|
||||
)
|
||||
|
||||
preferred_payment_method_line_id = fields.Many2one(string="Planned Payment Method")
|
||||
|
||||
@api.depends(
|
||||
"line_ids.matched_debit_ids.debit_move_id.date",
|
||||
"line_ids.matched_debit_ids.debit_move_id.move_id.origin_payment_id.date",
|
||||
"line_ids.matched_debit_ids.debit_move_id.move_id.statement_line_id",
|
||||
"line_ids.matched_credit_ids.credit_move_id.date",
|
||||
"line_ids.matched_credit_ids.credit_move_id.move_id.origin_payment_id.date",
|
||||
"line_ids.matched_credit_ids.credit_move_id.move_id.statement_line_id",
|
||||
)
|
||||
def _compute_last_payment_date(self):
|
||||
"""Compute the date of the last real payment.
|
||||
|
||||
Only customer and vendor invoices carry the information; every
|
||||
other move type gets the field cleared. Candidates are the
|
||||
reconciliation counterpart lines of the receivable/payable
|
||||
lines (exchange difference moves excluded). The most recent
|
||||
date wins.
|
||||
"""
|
||||
for move in self:
|
||||
move.last_payment_date = False
|
||||
if move.move_type not in ("in_invoice", "out_invoice"):
|
||||
continue
|
||||
dates = move._get_last_payment_dates()
|
||||
if dates:
|
||||
move.last_payment_date = max(dates)
|
||||
|
||||
def _get_last_payment_dates(self):
|
||||
"""Collect the dates of the real payments of this invoice.
|
||||
|
||||
A date is collected from each reconciliation counterpart line:
|
||||
|
||||
- counterpart move with ``origin_payment_id``: explicit
|
||||
payment, dated with the payment date;
|
||||
- counterpart move with ``statement_line_id``: direct bank
|
||||
statement reconciliation, dated with the counterpart move
|
||||
date;
|
||||
- any other manual reconciliation is ignored.
|
||||
|
||||
:return: list of dates, possibly empty.
|
||||
"""
|
||||
self.ensure_one()
|
||||
invoice_partials, exchange_diff_moves = self._get_reconciled_invoices_partials()
|
||||
dates = []
|
||||
for _partial, _amount, counterpart_line in invoice_partials:
|
||||
if counterpart_line.move_id.id in exchange_diff_moves:
|
||||
continue
|
||||
payment = counterpart_line.move_id.origin_payment_id
|
||||
if payment:
|
||||
dates.append(payment.date)
|
||||
elif counterpart_line.move_id.statement_line_id:
|
||||
dates.append(counterpart_line.move_id.date)
|
||||
return dates
|
||||
3
account_move_last_payment/pyproject.toml
Normal file
3
account_move_last_payment/pyproject.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
||||
1
account_move_last_payment/tests/__init__.py
Normal file
1
account_move_last_payment/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_last_payment
|
||||
233
account_move_last_payment/tests/test_last_payment.py
Normal file
233
account_move_last_payment/tests/test_last_payment.py
Normal file
@@ -0,0 +1,233 @@
|
||||
from odoo import fields
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
|
||||
|
||||
@tagged("post_install", "-at_install")
|
||||
class TestAccountMoveLastPayment(AccountTestInvoicingCommon):
|
||||
"""Test the last payment date stored on invoices."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
||||
cls.inbound_method_line = cls.company_data[
|
||||
"default_journal_bank"
|
||||
].inbound_payment_method_line_ids[0]
|
||||
|
||||
@classmethod
|
||||
def _create_posted_invoice(cls, move_type="out_invoice"):
|
||||
"""Create and post a simple invoice without taxes.
|
||||
|
||||
:param str move_type: the invoice type to create.
|
||||
:return: the posted account.move record.
|
||||
"""
|
||||
return cls.init_invoice(move_type, post=True, amounts=[1000.0], taxes=[])
|
||||
|
||||
@classmethod
|
||||
def _register_payment(cls, invoice, date=None, method_line=None, amount=None):
|
||||
"""Register a payment on an invoice through the payment wizard.
|
||||
|
||||
:param invoice: the account.move to pay.
|
||||
:param date: the payment date (defaults to today).
|
||||
:param method_line: the account.payment.method.line to use
|
||||
(defaults to the bank journal inbound method line).
|
||||
:param amount: the payment amount (defaults to the invoice
|
||||
residual).
|
||||
:return: the created account.payment record.
|
||||
"""
|
||||
return (
|
||||
cls.env["account.payment.register"]
|
||||
.with_context(
|
||||
active_model="account.move",
|
||||
active_ids=invoice.ids,
|
||||
)
|
||||
.create(
|
||||
{
|
||||
"payment_date": date or fields.Date.today(),
|
||||
"payment_method_line_id": (
|
||||
method_line or cls.inbound_method_line
|
||||
).id,
|
||||
"amount": amount if amount is not None else invoice.amount_residual,
|
||||
}
|
||||
)
|
||||
._create_payments()
|
||||
)
|
||||
|
||||
def _reconcile_statement_line(self, invoice, amount, date=None):
|
||||
"""Create a bank statement line and reconcile it with the invoice.
|
||||
|
||||
Mirrors the core reconciliation path: the statement line suspense
|
||||
counterpart is re-accounted to the invoice receivable account,
|
||||
then both lines are reconciled together.
|
||||
|
||||
:param invoice: the account.move to settle.
|
||||
:param float amount: the statement line amount.
|
||||
:param date: the statement line date (defaults to today).
|
||||
:return: the created account.bank.statement.line record.
|
||||
"""
|
||||
statement_line = self.env["account.bank.statement.line"].create(
|
||||
{
|
||||
"payment_ref": invoice.name,
|
||||
"journal_id": self.company_data["default_journal_bank"].id,
|
||||
"partner_id": invoice.partner_id.id,
|
||||
"amount": amount,
|
||||
"date": date or fields.Date.today(),
|
||||
}
|
||||
)
|
||||
st_liquidity_lines, st_suspense_lines, _ = statement_line._seek_for_lines()
|
||||
receivable_lines = invoice.line_ids.filtered(
|
||||
lambda line: line.account_type == "asset_receivable"
|
||||
)
|
||||
st_suspense_lines.account_id = receivable_lines.account_id
|
||||
(st_suspense_lines + receivable_lines).reconcile()
|
||||
return statement_line
|
||||
|
||||
def test_register_payment(self):
|
||||
"""Explicit payment: the field matches the payment date."""
|
||||
invoice = self._create_posted_invoice()
|
||||
payment = self._register_payment(invoice)
|
||||
self.assertEqual(invoice.last_payment_date, payment.date)
|
||||
|
||||
def test_bank_statement_reconciliation(self):
|
||||
"""Direct statement reconciliation: the statement date."""
|
||||
invoice = self._create_posted_invoice()
|
||||
yesterday = fields.Date.subtract(fields.Date.today(), days=1)
|
||||
statement_line = self._reconcile_statement_line(
|
||||
invoice, invoice.amount_total, date=yesterday
|
||||
)
|
||||
self.assertEqual(invoice.last_payment_date, statement_line.date)
|
||||
|
||||
def test_list_view_and_export(self):
|
||||
"""The date is stored; date and preferred payment method are listed."""
|
||||
self.assertTrue(self.env["account.move"]._fields["last_payment_date"].store)
|
||||
view = self.env["ir.ui.view"]._get_view_id("account.view_invoice_tree")
|
||||
arch = self.env["account.move"].get_view(view_id=view, view_type="list")["arch"]
|
||||
self.assertIn('name="last_payment_date"', arch)
|
||||
|
||||
def test_multiple_payments_keeps_latest(self):
|
||||
"""With several payments, the most recent candidate wins."""
|
||||
invoice = self._create_posted_invoice()
|
||||
older_date = fields.Date.subtract(fields.Date.today(), days=10)
|
||||
newer_date = fields.Date.subtract(fields.Date.today(), days=2)
|
||||
self._register_payment(invoice, date=older_date, amount=400.0)
|
||||
self._register_payment(invoice, date=newer_date, amount=600.0)
|
||||
self.assertEqual(invoice.last_payment_date, newer_date)
|
||||
|
||||
def test_statement_newer_than_payment(self):
|
||||
"""A more recent statement reconciliation wins over an older payment."""
|
||||
invoice = self._create_posted_invoice()
|
||||
older_date = fields.Date.subtract(fields.Date.today(), days=10)
|
||||
newer_date = fields.Date.subtract(fields.Date.today(), days=2)
|
||||
self._register_payment(invoice, date=older_date, amount=400.0)
|
||||
self._reconcile_statement_line(invoice, 600.0, date=newer_date)
|
||||
self.assertEqual(invoice.last_payment_date, newer_date)
|
||||
|
||||
def test_statement_line_date_change_recompute(self):
|
||||
"""Changing the statement line date updates the stored fields."""
|
||||
invoice = self._create_posted_invoice()
|
||||
yesterday = fields.Date.subtract(fields.Date.today(), days=1)
|
||||
statement_line = self._reconcile_statement_line(
|
||||
invoice, invoice.amount_total, date=yesterday
|
||||
)
|
||||
self.assertEqual(invoice.last_payment_date, yesterday)
|
||||
older_date = fields.Date.subtract(fields.Date.today(), days=30)
|
||||
statement_line.date = older_date
|
||||
self.assertEqual(invoice.last_payment_date, older_date)
|
||||
|
||||
def test_unreconcile_clears_fields(self):
|
||||
"""Unreconciling the invoice clears the field."""
|
||||
invoice = self._create_posted_invoice()
|
||||
self._register_payment(invoice)
|
||||
invoice.line_ids.remove_move_reconcile()
|
||||
self.assertFalse(invoice.last_payment_date)
|
||||
|
||||
def _setup_eur_rates(self, invoice_date, payment_date):
|
||||
"""Set deterministic EUR rates so the payment creates an
|
||||
exchange difference move.
|
||||
|
||||
:param invoice_date: the invoice posting date.
|
||||
:param payment_date: the payment date.
|
||||
:return: the EUR res.currency record.
|
||||
"""
|
||||
eur = self.env.ref("base.EUR")
|
||||
if not eur.active:
|
||||
eur.active = True
|
||||
self.env["res.currency.rate"].search(
|
||||
[
|
||||
("currency_id", "=", eur.id),
|
||||
("name", "in", [invoice_date, payment_date]),
|
||||
]
|
||||
).unlink()
|
||||
self.env["res.currency.rate"].create(
|
||||
[
|
||||
{"currency_id": eur.id, "name": invoice_date, "rate": 1.0},
|
||||
{"currency_id": eur.id, "name": payment_date, "rate": 1.1},
|
||||
]
|
||||
)
|
||||
return eur
|
||||
|
||||
def test_multicurrency_invoice(self):
|
||||
"""A foreign currency payment keeps its real date, and the
|
||||
generated exchange difference move is not taken as a payment."""
|
||||
payment_date = fields.Date.subtract(fields.Date.today(), days=5)
|
||||
invoice_date = fields.Date.from_string("2019-01-01")
|
||||
eur = self._setup_eur_rates(invoice_date, payment_date)
|
||||
invoice = self.init_invoice("out_invoice", post=False, amounts=[1000.0])
|
||||
invoice.currency_id = eur
|
||||
invoice.action_post()
|
||||
payment = self._register_payment(
|
||||
invoice,
|
||||
date=payment_date,
|
||||
amount=invoice.amount_residual,
|
||||
)
|
||||
self.assertTrue(invoice.line_ids.mapped("matched_credit_ids.exchange_move_id"))
|
||||
dates = invoice._get_last_payment_dates()
|
||||
self.assertEqual(dates, [payment.date])
|
||||
self.assertEqual(invoice.last_payment_date, payment.date)
|
||||
|
||||
def test_draft_invoice_is_empty(self):
|
||||
"""A draft invoice has never been reconciled, so the field
|
||||
stays empty."""
|
||||
invoice = self.init_invoice("out_invoice", post=False, amounts=[1000.0])
|
||||
self.assertFalse(invoice.last_payment_date)
|
||||
|
||||
def test_non_invoice_moves_are_empty(self):
|
||||
"""Journal entries and credit notes never carry the field."""
|
||||
invoice = self._create_posted_invoice()
|
||||
self._register_payment(invoice)
|
||||
refund = self._create_posted_invoice(move_type="out_refund")
|
||||
entry = self.env["account.move"].create(
|
||||
{
|
||||
"move_type": "entry",
|
||||
"journal_id": self.company_data["default_journal_misc"].id,
|
||||
"date": fields.Date.today(),
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"account_id": self.company_data[
|
||||
"default_account_revenue"
|
||||
].id,
|
||||
"debit": 100.0,
|
||||
},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"account_id": self.company_data[
|
||||
"default_account_receivable"
|
||||
].id,
|
||||
"credit": 100.0,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
entry.action_post()
|
||||
self.assertFalse(refund.last_payment_date)
|
||||
self.assertFalse(entry.last_payment_date)
|
||||
self.assertTrue(invoice.last_payment_date)
|
||||
13
account_move_last_payment/views/account_move_views.xml
Normal file
13
account_move_last_payment/views/account_move_views.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_invoice_tree_last_payment" model="ir.ui.view">
|
||||
<field name="name">account.invoice.list.last.payment</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_invoice_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="amount_residual_signed" position="after">
|
||||
<field name="last_payment_date" optional="show" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
2
account_partner_account_number/__init__.py
Normal file
2
account_partner_account_number/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
from . import models
|
||||
@@ -1,25 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
"name": "Invoice and sale order note",
|
||||
"name": "Account partner account number",
|
||||
"category": "Account",
|
||||
"version": "16.0.2.0.0",
|
||||
"summary": "Add note in sale orders, sale orders templates and invoices document",
|
||||
"version": "18.0.1.0.0",
|
||||
"summary": "Add account number in partner",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"description": """
|
||||
==========================================
|
||||
Invoice and sale order note
|
||||
==========================================
|
||||
Add note field in invoices and sale order
|
||||
Display this field in generated documents
|
||||
Copy note field when invoice created from sale order
|
||||
======================================
|
||||
Account partner account number
|
||||
======================================
|
||||
This module add a new field in partner, visible in account move lines for payable and receivable accounts
|
||||
|
||||
Installation
|
||||
============
|
||||
Just install invoice_sale_order_note, all dependencies will be installed by default.
|
||||
Just install account_partner_account_number, all dependencies will be installed by default.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
@@ -40,13 +37,13 @@ Images
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* Clément Thomas
|
||||
* Clément Thoams
|
||||
|
||||
Funders
|
||||
-------
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
* Coopérative Tiers-Lieux
|
||||
* Rovalterre
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
@@ -56,15 +53,10 @@ This module is maintained by ELABORE.
|
||||
"depends": [
|
||||
"base",
|
||||
"account",
|
||||
"sale",
|
||||
"sale_management",
|
||||
],
|
||||
"data": [
|
||||
"views/sale_views.xml",
|
||||
"views/account_move_views.xml",
|
||||
"views/account_invoice_report.xml",
|
||||
"views/sale_order_report.xml",
|
||||
"views/sale_order_template_views.xml",
|
||||
"views/partner_views.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
}
|
||||
61
account_partner_account_number/i18n/fr.po
Normal file
61
account_partner_account_number/i18n/fr.po
Normal file
@@ -0,0 +1,61 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_partner_account_number
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-06-09 07:37+0000\n"
|
||||
"PO-Revision-Date: 2023-06-09 07:37+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_account_move_line__account_code
|
||||
msgid "Account code"
|
||||
msgstr "Code comptable"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_res_partner__account_code
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_res_users__account_code
|
||||
#: model_terms:ir.ui.view,arch_db:account_partner_account_number.view_partner_property_form_account_code
|
||||
msgid "Account code"
|
||||
msgstr "Code comptable"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.constraint,message:account_partner_account_number.constraint_res_partner_account_coder_unique
|
||||
msgid "Choose another value of account code - it has to be unique!"
|
||||
msgstr "Choisissez une autre valeur de code comptable - il doit être unique !"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model,name:account_partner_account_number.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_account_move_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_res_partner__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_account_move_line__id
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_res_partner__id
|
||||
msgid "ID"
|
||||
msgstr "Identifiant"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model,name:account_partner_account_number.model_account_move_line
|
||||
msgid "Journal Item"
|
||||
msgstr "Écriture comptable"
|
||||
|
||||
#. module: account_partner_account_number
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_account_move_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_partner_account_number.field_res_partner____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
2
account_partner_account_number/models/__init__.py
Normal file
2
account_partner_account_number/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import res_partner
|
||||
from . import account_move_line
|
||||
20
account_partner_account_number/models/account_move_line.py
Normal file
20
account_partner_account_number/models/account_move_line.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from odoo import fields, models, _, api
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
account_code = fields.Char(compute='get_account_code', string="Account code")
|
||||
|
||||
@api.depends('partner_id','account_id')
|
||||
def get_account_code(self):
|
||||
"""
|
||||
assign account number of partner if move line is receivable (Customers) or payable (Suppliers)
|
||||
"""
|
||||
for account_move_line in self:
|
||||
if account_move_line.account_id.id == account_move_line.partner_id.commercial_partner_id.property_account_receivable_id.id or \
|
||||
account_move_line.account_id.id == account_move_line.partner_id.commercial_partner_id.property_account_payable_id.id:
|
||||
account_move_line.account_code = account_move_line.partner_id.commercial_partner_id.account_code
|
||||
else:
|
||||
account_move_line.account_code = ''
|
||||
|
||||
13
account_partner_account_number/models/res_partner.py
Normal file
13
account_partner_account_number/models/res_partner.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from odoo import fields, models, _
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
account_code = fields.Char('Account code')
|
||||
|
||||
_sql_constraints = [
|
||||
('account_coder_unique',
|
||||
'unique(account_code)',
|
||||
'Choose another value of account code - it has to be unique!')
|
||||
]
|
||||
14
account_partner_account_number/views/account_move_views.xml
Normal file
14
account_partner_account_number/views/account_move_views.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_move_line_tree_inherit_account_code" model="ir.ui.view">
|
||||
<field name="name">account.move.line.list.inherit.account.number</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field eval="100" name="priority"/>
|
||||
<field name="inherit_id" ref="account.view_move_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="account_code" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
17
account_partner_account_number/views/partner_views.xml
Normal file
17
account_partner_account_number/views/partner_views.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_partner_property_form_account_code" model="ir.ui.view">
|
||||
<field name="name">res.partner.property.form.inherit.account.number</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="inherit_id" ref="account.view_partner_property_form"/>
|
||||
<field name="groups_id" eval="[(5,)]"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='accounting']/group" position="inside">
|
||||
<group string="Account code" name="account_code" groups="account.group_account_readonly">
|
||||
<field name="account_code" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,44 +0,0 @@
|
||||
===============
|
||||
account_payment_method_report_invoice_document
|
||||
===============
|
||||
|
||||
Add payment method on invoice document (if selected)
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
``account_payment_method_report_invoice_document``.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
None yet.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/account_payment_method_report_invoice_document/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
|
||||
------------
|
||||
|
||||
* Boris Gallet - `Email<mailto:boris.gallet@elabore.coop>` - `Github<https://github.com/b0g>`
|
||||
|
||||
Funders
|
||||
-------
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by Elabore.
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# Copyright 2024 Boris Gallet ()
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "account_payment_method_report_invoice_document",
|
||||
"version": "16.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"maintainer": "Boris Gallet",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
"summary": "Add payment method on invoice document (if selected)",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"base",
|
||||
"account_payment_mode",
|
||||
"account_payment_partner"
|
||||
],
|
||||
"qweb": [],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
"views/add_payment_mode_on_invoice_report.xml"
|
||||
],
|
||||
# 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,
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_payment_method_report_invoice_document
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-01-18 13:12+0000\n"
|
||||
"PO-Revision-Date: 2024-01-18 13:12+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_payment_method_report_invoice_document
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_method_report_invoice_document.payment_method_report_invoice_document
|
||||
msgid "Payment Method :"
|
||||
msgstr ""
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<template id="payment_method_report_invoice_document" name="Payment method on invoice document" inherit_id="account.report_invoice_document" priority="40">
|
||||
<xpath expr="//t[@t-set='payment_term_details']" position="before">
|
||||
<t t-if="o.payment_mode_id">
|
||||
<p>
|
||||
Payment Method : <span t-field="o.payment_mode_id"/>
|
||||
</p>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -1,4 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -1,59 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2025 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Account Quotation Sale Order Invoice Title",
|
||||
"category": "Account",
|
||||
"version": "16.0.1.0",
|
||||
"summary": "Transfer the Receipt Lost value in invoices and account move lines",
|
||||
"version": "18.0.1.0.1",
|
||||
"category": "Accounting",
|
||||
"summary": "Add title field in Quotations, Sale Orders and Invoices",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"description": """
|
||||
==========================================
|
||||
Account Quotation Sale Order Invoice Title
|
||||
==========================================
|
||||
This module allows to add a title in Quotations, Sale Orders and Invoices.
|
||||
When an invoice is created from a Sale Order, the title is transfered.
|
||||
|
||||
Installation
|
||||
============
|
||||
Just install account_quotation_sale_order_invoice_title, all dependencies will be installed by default.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/elabore-coop/.../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
|
||||
------------
|
||||
* Stéphan Sainléger <https://github.com/stephansainleger>
|
||||
|
||||
Funders
|
||||
-------
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
* Datactivist (https://datactivist.coop)
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
This module is maintained by ELABORE.
|
||||
|
||||
""",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"base",
|
||||
"account",
|
||||
"sale",
|
||||
],
|
||||
@@ -63,5 +19,7 @@ This module is maintained by ELABORE.
|
||||
"views/account_invoice_report.xml",
|
||||
"views/sale_order_report.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import account_move
|
||||
from . import sale
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
_inherit = "account.move"
|
||||
|
||||
move_title = fields.Char(string="Invoice Title")
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
@@ -9,6 +7,6 @@ class SaleOrder(models.Model):
|
||||
so_title = fields.Char(string="Title")
|
||||
|
||||
def _prepare_invoice(self):
|
||||
res = super(SaleOrder, self)._prepare_invoice()
|
||||
res = super()._prepare_invoice()
|
||||
res["move_title"] = self.so_title
|
||||
return res
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//span[@t-field='o.name']" position="after">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_move_title_tree" model="ir.ui.view">
|
||||
<field name="name">move_title.move.tree</field>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template id="report_saleorder_document" inherit_id="sale.report_saleorder_document">
|
||||
<template
|
||||
id="report_saleorder_document"
|
||||
inherit_id="sale.report_saleorder_document"
|
||||
>
|
||||
<xpath expr="//span[@t-field='doc.name']" position="after">
|
||||
<div t-field="doc.so_title"></div>
|
||||
<div t-field="doc.so_title" />
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_order_title_tree" model="ir.ui.view">
|
||||
<field name="name">so_title.sale.order.tree</field>
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import sale_make_invoice_advance
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class SaleAdvancePaymentInv(models.TransientModel):
|
||||
_inherit = "sale.advance.payment.inv"
|
||||
|
||||
def _prepare_invoice_values(self, order, so_line):
|
||||
res = super(SaleAdvancePaymentInv, self)._prepare_invoice_values(
|
||||
order, so_line
|
||||
)
|
||||
def _prepare_invoice_values(self, order, so_line, accounts):
|
||||
res = super()._prepare_invoice_values(order, so_line, accounts)
|
||||
res["move_title"] = order.so_title
|
||||
return res
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
===============================
|
||||
contract_fix_compute_journal_id
|
||||
===============================
|
||||
=======================================================
|
||||
account_statement_import_online_ponto_credit_cooperatif
|
||||
=======================================================
|
||||
|
||||
Correct the way journal_id is populated when we change contract_type.
|
||||
Retrieve more information when we retrieve bank statement lines from MyPonto for Crédit coopératif bank.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
``contract_fix_compute_journal_id``.
|
||||
``account_statement_import_online_ponto_credit_cooperatif``.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
@@ -18,7 +18,7 @@ None yet.
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/contract_fix_compute_journal_id/issues>`_. In case of
|
||||
Bugs are tracked on `our issues website <https://git.elabore.coop/Elabore/account-tools>`_. 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.
|
||||
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
@@ -1,31 +1,27 @@
|
||||
# Copyright 2024 Boris Gallet ()
|
||||
# Copyright 2026 Quentin Mondot
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Contract Fix Compute Journal Id",
|
||||
"version": "16.0.1.0.0",
|
||||
"name": "Account statement import online ponto for Credit Cooperatif",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"maintainer": "Quentin Mondot",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
"summary": "Use journal id of the contract_template",
|
||||
"summary": "Refacturer 1H à chaque installation : à décompter de https://elabore.coop/mail/view?model=project.task&res_id=5564&access_token=be355b7d-8ee5-44a6-9658-7de2649d0bd2. "
|
||||
"Customization of OCA account_statement_import_online_ponto to retrieve more information with Credit Cooperatif bank",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"base",
|
||||
"contract"
|
||||
"account_statement_import_online_ponto"
|
||||
],
|
||||
"qweb": [],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
],
|
||||
"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.
|
||||
@@ -0,0 +1 @@
|
||||
from . import online_bank_statement_provider_ponto
|
||||
@@ -0,0 +1,62 @@
|
||||
import json
|
||||
import logging
|
||||
from typing import Any, Optional
|
||||
|
||||
from odoo import models
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OnlineBankStatementProvider(models.Model):
|
||||
_inherit = "online.bank.statement.provider"
|
||||
|
||||
def _extract_detail(self, details: list[str], prefix: str) -> Optional[str]:
|
||||
return next(
|
||||
(d.split(" : ", 1)[1] for d in details if d.startswith(prefix)),
|
||||
None,
|
||||
)
|
||||
|
||||
def _ponto_get_transaction_vals(
|
||||
self, transaction: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""Add additional information to the bank statement line"""
|
||||
self.ensure_one()
|
||||
vals_line = super()._ponto_get_transaction_vals(transaction)
|
||||
attributes = transaction.get("attributes", {})
|
||||
if attributes.get("additionalInformation"):
|
||||
try:
|
||||
details = json.loads(attributes["additionalInformation"]).get(
|
||||
"details", []
|
||||
)
|
||||
|
||||
ref_operation = self._extract_detail(
|
||||
details, "Référence de l'opération"
|
||||
)
|
||||
if ref_operation and ref_operation != vals_line["payment_ref"]:
|
||||
vals_line["payment_ref"] = (
|
||||
f"{vals_line['payment_ref']} {ref_operation}"
|
||||
)
|
||||
|
||||
operation_reason = self._extract_detail(details, "Motif de l'opération")
|
||||
if operation_reason and operation_reason != vals_line["ref"]:
|
||||
vals_line["ref"] = f"{vals_line['ref']} {operation_reason}"
|
||||
|
||||
if "partner_name" not in vals_line:
|
||||
creditor_name = self._extract_detail(details, "Nom du créancier")
|
||||
if creditor_name:
|
||||
vals_line["partner_name"] = creditor_name
|
||||
|
||||
if not vals_line.get("partner_id") and vals_line.get("partner_name"):
|
||||
partner = self.env["res.partner"].search(
|
||||
[("name", "ilike", vals_line["partner_name"])],
|
||||
limit=1,
|
||||
)
|
||||
if partner:
|
||||
vals_line["partner_id"] = partner.id
|
||||
except (json.JSONDecodeError, AttributeError):
|
||||
_logger.warning(
|
||||
"Ponto: impossible to parse additionalInformation for the transaction %s : %s",
|
||||
transaction.get("id"),
|
||||
attributes.get("additionalInformation"),
|
||||
)
|
||||
return vals_line
|
||||
@@ -1,21 +1,22 @@
|
||||
{
|
||||
'name': 'Account Sub-accounts',
|
||||
'version': '16.0.1.0.0',
|
||||
'summary': 'Add sub-account fields in res.partners and account.move.line, and sync them.',
|
||||
'author': 'Elabore',
|
||||
'website': 'https://elabore.coop/',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Accounting',
|
||||
'depends': [
|
||||
'account',
|
||||
'base',
|
||||
"name": "Account Sub-accounts",
|
||||
"version": "18.0.1.0.0",
|
||||
"summary": "Add sub-account fields in res.partners and account.move.line, "
|
||||
"and sync them.",
|
||||
"author": "Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"category": "Accounting",
|
||||
"depends": [
|
||||
"account",
|
||||
"base",
|
||||
],
|
||||
'data': [
|
||||
'views/res_partner_views.xml',
|
||||
'views/account_move_line_views.xml',
|
||||
"data": [
|
||||
"views/res_partner_views.xml",
|
||||
"views/account_move_line_views.xml",
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'application': False,
|
||||
'assets': {},
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
"assets": {},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-04-25 08:29+0000\n"
|
||||
"PO-Revision-Date: 2025-04-25 10:30+0200\n"
|
||||
|
||||
@@ -5,11 +5,9 @@ class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
sub_account_customer = fields.Char(
|
||||
string="Custommer sub-account",
|
||||
related="partner_id.sub_account_customer"
|
||||
string="Custommer sub-account", related="partner_id.sub_account_customer"
|
||||
)
|
||||
|
||||
sub_account_supplier = fields.Char(
|
||||
string="Supplier sub-account",
|
||||
related="partner_id.sub_account_supplier"
|
||||
string="Supplier sub-account", related="partner_id.sub_account_supplier"
|
||||
)
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="account_move_line_tree_sub_accounts_view" model="ir.ui.view">
|
||||
<field name="name">Account Move Line sub-accounts tree view</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='analytic_distribution']" position="after">
|
||||
<field name="sub_account_customer" optional="hide"/>
|
||||
<field name="sub_account_supplier" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
<record id="account_move_line_tree_sub_accounts_view" model="ir.ui.view">
|
||||
<field name="name">Account Move Line sub-accounts tree view</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='analytic_distribution']" position="after">
|
||||
<field name="sub_account_customer" optional="hide" />
|
||||
<field name="sub_account_supplier" optional="hide" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="res_partner_form_sub_accounts_view" model="ir.ui.view">
|
||||
<field name="name">Res Partner sub-accounts form view</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="account.view_partner_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='accounting']/group" position="inside">
|
||||
<group string="Sub-accounts" name="sub_accounts">
|
||||
<field name="sub_account_customer" />
|
||||
<field name="sub_account_supplier" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
<record id="res_partner_form_sub_accounts_view" model="ir.ui.view">
|
||||
<field name="name">Res Partner sub-accounts form view</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="account.view_partner_property_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='accounting']/group" position="inside">
|
||||
<group string="Sub-accounts" name="sub_accounts">
|
||||
<field name="sub_account_customer" />
|
||||
<field name="sub_account_supplier" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
==============================
|
||||
account_usability_deposit_menu
|
||||
==============================
|
||||
|
||||
Various chantes to improve the usability of Account application
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
``account_usability_deposit_menu``.
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
- Brings together the check and the cash deposit submenus under a common Deposit menu
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
None yet.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/bank_statement_line_prevent_creating/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
|
||||
------------
|
||||
|
||||
* Laetitia Da Costa
|
||||
|
||||
Funders
|
||||
-------
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by Elabore.
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
'name': 'Account Usability Deposit Menu',
|
||||
'version': '16.0.1.0.0',
|
||||
'description': 'Create Deposit menu',
|
||||
'summary': 'Brings together the check and the cash deposit submenus under a common Deposit menu ',
|
||||
'author': 'Elabore',
|
||||
'website': 'https://elabore.coop/',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Accounting',
|
||||
'depends': [
|
||||
'account_check_deposit',
|
||||
'account_cash_deposit',
|
||||
],
|
||||
'data': [
|
||||
'views/account_menu.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'application': False,
|
||||
'assets': {
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_usability_deposit_menu
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-01-18 10:32+0000\n"
|
||||
"PO-Revision-Date: 2024-01-18 10:32+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_usability_deposit_menu
|
||||
#: model:ir.ui.menu,name:account_usability_deposit_menu.deposit_menu
|
||||
msgid "Deposit"
|
||||
msgstr "Dépôt"
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<menuitem
|
||||
id="deposit_menu"
|
||||
name="Deposit"
|
||||
parent="account.menu_finance"
|
||||
sequence="5"/>
|
||||
<menuitem
|
||||
id="account_cash_deposit.account_cash_deposit_menu"
|
||||
parent="account_usability_deposit_menu.deposit_menu"
|
||||
sequence="1"/>
|
||||
<menuitem
|
||||
id="account_check_deposit.menu_check_deposit_tree"
|
||||
parent="account_usability_deposit_menu.deposit_menu"
|
||||
sequence="2"/>
|
||||
</odoo>
|
||||
@@ -2,7 +2,7 @@
|
||||
account_usability_misc
|
||||
======================
|
||||
|
||||
Various chantes to improve the usability of Account application
|
||||
Various changes to improve the usability of Account application
|
||||
|
||||
Installation
|
||||
============
|
||||
@@ -10,13 +10,19 @@ Installation
|
||||
Use Odoo normal module installation procedure to install
|
||||
``account_usability_misc``.
|
||||
|
||||
This module depends on:
|
||||
|
||||
* ``account``
|
||||
* ``base``
|
||||
* ``account_reconcile_oca`` (available in OCA/account-reconcile repository)
|
||||
* ``account_statement_base`` (available in OCA/account-reconcile repository)
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
- Removes the right to unlink bank statements and bank statement lines for all users
|
||||
- Changes some french translation
|
||||
- On reconcile view : filter account move lines by defaut with journal type
|
||||
- Hide Create button in Bank Statement tree view
|
||||
- Create a technical group with unlink righ on bank statements and bank statement lines
|
||||
|
||||
Known issues / Roadmap
|
||||
@@ -27,7 +33,7 @@ None yet.
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/bank_statement_line_prevent_creating/issues>`_. In case of
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/account-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.
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
# Copyright 2025 Elabore
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Account Usability Misc',
|
||||
'version': '16.0.2.0.0',
|
||||
'description': 'account usability misc : improve account usability in v16',
|
||||
'summary': 'Various chantes to improve the usability of Account application',
|
||||
'author': 'Elabore',
|
||||
'website': 'https://elabore.coop/',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Accounting',
|
||||
'depends': [
|
||||
'account',
|
||||
'base',
|
||||
'account_reconcile_oca',
|
||||
'account_statement_base',
|
||||
"name": "Account Usability Misc",
|
||||
"version": "18.0.1.0.0",
|
||||
"summary": "Various changes to improve the usability of Account application",
|
||||
"author": "Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/account-tools",
|
||||
"license": "AGPL-3",
|
||||
"category": "Accounting",
|
||||
"depends": [
|
||||
"account",
|
||||
"account_reconcile_oca",
|
||||
"account_statement_base",
|
||||
],
|
||||
'data': [
|
||||
'views/account_search.xml',
|
||||
'views/account_tree_view.xml',
|
||||
'views/bank_statement_line_views.xml',
|
||||
'views/bank_statement_views.xml',
|
||||
"data": [
|
||||
"views/account_search.xml",
|
||||
"views/account_tree_view.xml",
|
||||
"views/bank_statement_line_views.xml",
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'application': False,
|
||||
'assets': {},
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
|
||||
@@ -4,11 +4,17 @@ from odoo import fields, models
|
||||
class AccountBankStatementLine(models.Model):
|
||||
_inherit = "account.bank.statement.line"
|
||||
|
||||
move_line_journal_type = fields.Char(string="Journal Type", compute="_compute_move_line_journal_type")
|
||||
move_line_journal_type = fields.Char(
|
||||
string="Journal Type", compute="_compute_move_line_journal_type"
|
||||
)
|
||||
|
||||
def _compute_move_line_journal_type(self):
|
||||
for rec in self:
|
||||
if self._context.get('default_journal_id'):
|
||||
rec.move_line_journal_type = self.env["account.journal"].browse(self._context.get('default_journal_id')).type
|
||||
if self._context.get("default_journal_id"):
|
||||
rec.move_line_journal_type = (
|
||||
self.env["account.journal"]
|
||||
.browse(self._context.get("default_journal_id"))
|
||||
.type
|
||||
)
|
||||
else:
|
||||
rec.move_line_journal_type = None
|
||||
|
||||
@@ -1,39 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="account_move_line_search_reconcile_view_inherit" model="ir.ui.view">
|
||||
<field name="name">Account move line search reconcile view inherit</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account_reconcile_oca.account_move_line_search_reconcile_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<field name="name" position="attributes">
|
||||
<attribute name="filter_domain">['|', '|', '|', ('name', 'ilike', self), ('amount_residual', 'ilike', self), ('ref', 'ilike', self), ('partner_id', 'ilike', self)]</attribute>
|
||||
<attribute name="string">Amount/Name/Partner</attribute>
|
||||
</field>
|
||||
</data>
|
||||
<record id="account_move_line_search_reconcile_view_inherit" model="ir.ui.view">
|
||||
<field name="name">Account move line search reconcile view inherit</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_reconcile_oca.account_move_line_search_reconcile_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="attributes">
|
||||
<attribute
|
||||
name="filter_domain"
|
||||
>['|', '|', '|', ('name', 'ilike', self), ('amount_residual', 'ilike', self), ('ref', 'ilike', self), ('partner_id', 'ilike', self)]</attribute>
|
||||
<attribute name="string">Amount/Name/Partner</attribute>
|
||||
</field>
|
||||
</record>
|
||||
<record id="bank_statement_line_form_reconcile_view_inerit" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.line.reconcile.inherit</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="inherit_id" ref="account_reconcile_oca.bank_statement_line_form_reconcile_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='add_account_move_line_id']" position="before">
|
||||
<field name='move_line_journal_type' invisible="1"></field>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='add_account_move_line_id']" position="attributes">
|
||||
<attribute name="context">{
|
||||
'search_default_cash': move_line_journal_type == 'cash',
|
||||
'search_default_purchases': move_line_journal_type == 'purchases',
|
||||
'search_default_sales': move_line_journal_type == 'sales',
|
||||
'search_default_general': move_line_journal_type == 'general',
|
||||
'search_default_partner_id': partner_id,
|
||||
'tree_view_ref': 'account_reconcile_oca.account_move_line_tree_reconcile_view',
|
||||
'search_view_ref': 'account_reconcile_oca.account_move_line_search_reconcile_view'}</attribute>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
<record id="bank_statement_line_form_reconcile_view_inerit" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.line.reconcile.inherit</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_reconcile_oca.bank_statement_line_form_reconcile_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='add_account_move_line_id']" position="before">
|
||||
<field name="move_line_journal_type" invisible="1" />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='add_account_move_line_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="context">{
|
||||
'search_default_cash': move_line_journal_type == 'cash',
|
||||
'search_default_purchases': move_line_journal_type == 'purchases',
|
||||
'search_default_sales': move_line_journal_type == 'sales',
|
||||
'search_default_general': move_line_journal_type == 'general',
|
||||
'search_default_partner_id': partner_id,
|
||||
'list_view_ref': 'account_reconcile_oca.account_move_line_tree_reconcile_view',
|
||||
'search_view_ref': 'account_reconcile_oca.account_move_line_search_reconcile_view'}</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="account_view_tree_inherit_message_attachment" model="ir.ui.view">
|
||||
<field name="name">account view tree inherit message attachment</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_in_invoice_bill_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<field name="state" position="after">
|
||||
<field name="message_attachment_count"/>
|
||||
</field>
|
||||
</data>
|
||||
<record id="account_view_tree_inherit_message_attachment" model="ir.ui.view">
|
||||
<field name="name">account view tree inherit message attachment</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_in_invoice_bill_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="status_in_payment" position="after">
|
||||
<field name="message_attachment_count" />
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,32 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- Hide Create button in line view -->
|
||||
<record
|
||||
id="account_bank_statement_line_tree_inherit_hide_create"
|
||||
model="ir.ui.view"
|
||||
>
|
||||
<field name="name">account.bank.statement.line.tree.inherit.hide.create</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_statement_base.account_bank_statement_line_tree"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//list" position="attributes">
|
||||
<attribute name="create">false</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Hide Create button in line view -->
|
||||
|
||||
<record id="account_bank_statement_line_tree_inherit_hide_create" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.line.tree.inherit.hide.create</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="inherit_id" ref="account_statement_base.account_bank_statement_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="attributes">
|
||||
<attribute name="create">false</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Hide Create button in kanban view -->
|
||||
|
||||
<record id="account_bank_statement_line_kanban_inherit_hide_create" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.line.kanban.inherit.hide.create</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="inherit_id" ref="account_reconcile_oca.bank_statement_line_reconcile_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//kanban" position="attributes">
|
||||
<attribute name="create">false</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
<!-- Hide Create button in kanban view -->
|
||||
<record
|
||||
id="account_bank_statement_line_kanban_inherit_hide_create"
|
||||
model="ir.ui.view"
|
||||
>
|
||||
<field
|
||||
name="name"
|
||||
>account.bank.statement.line.kanban.inherit.hide.create</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_reconcile_oca.bank_statement_line_reconcile_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//kanban" position="attributes">
|
||||
<attribute name="create">false</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user