Merge pull request #62 from Noviat/18.0

Syncing from upstream Noviat/account_ebics (18.0)
This commit is contained in:
braintec 2025-07-04 01:12:40 +02:00 committed by GitHub
commit 51e099ab74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 636 additions and 19 deletions

View File

@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier # Do NOT update manually; changes here will be overwritten by Copier
_commit: v4.3 _commit: v4.8
_src_path: git@github.com:Noviat-CI/addons-repo-template.git _src_path: git@github.com:Noviat-CI/addons-repo-template.git
ci_disable_autoinstall_modules: account_asset ci_disable_autoinstall_modules: account_asset
odoo_test_flavor: Both odoo_test_flavor: Both

View File

@ -46,7 +46,7 @@ jobs:
name: test with Odoo Enterprise name: test with Odoo Enterprise
odoo_enterprise : 1 odoo_enterprise : 1
exclude_modules : "account_asset" exclude_modules : "account_asset"
makepot: true makepot: "true"
services: services:
postgres: postgres:
image: postgres:12.0 image: postgres:12.0
@ -80,7 +80,11 @@ jobs:
mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup
find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \; find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \;
find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \; find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \;
<<<<<<< before updating
if [ -n ${{ matrix.exclude }} ] if [ -n ${{ matrix.exclude }} ]
=======
if [ -n ${{ matrix.exclude}} ]
>>>>>>> after updating
then then
remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }} remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }}
fi fi
@ -93,10 +97,10 @@ jobs:
run: | run: |
echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV
- name: Add addons to EXCLUDE PATH - name: Add addons to EXCLUDE PATH
if: ${{ env.EXCLUDE_MODULES }} if: ${{ matrix.EXCLUDE_MODULES }}
run: | run: |
echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC} echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC}
echo "modules_auto_install_disabled = $EXCLUDE_MODULES" >> ${ODOO_RC} echo "ODOO_MODULES_AUTO_INSTALL_DISABLED=${{ matrix.EXCLUDE_MODULES }}" >> $GITHUB_ENV
- name: Install addons and dependencies - name: Install addons and dependencies
run: | run: |
(ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons) (ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons)

View File

@ -38,6 +38,10 @@ repos:
entry: found a en.po file entry: found a en.po file
language: fail language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$' files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/sbidoul/whool
rev: v1.2
hooks:
- id: whool-init
- repo: https://github.com/oca/maintainer-tools - repo: https://github.com/oca/maintainer-tools
rev: bf9ecb9938b6a5deca0ff3d870fbd3f33341fded rev: bf9ecb9938b6a5deca0ff3d870fbd3f33341fded
hooks: hooks:
@ -45,6 +49,7 @@ repos:
- id: oca-update-pre-commit-excluded-addons - id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website - id: oca-fix-manifest-website
args: ["https://www.noviat.com/"] args: ["https://www.noviat.com/"]
- id: oca-gen-external-dependencies
- id: oca-gen-addons-table - id: oca-gen-addons-table
- repo: https://github.com/OCA/odoo-pre-commit-hooks - repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.33 rev: v0.0.33

View File

@ -15,9 +15,10 @@ Available addons
---------------- ----------------
addon | version | maintainers | summary addon | version | maintainers | summary
--- | --- | --- | --- --- | --- | --- | ---
[account_ebics](account_ebics/) | 18.0.1.0.0 | | EBICS banking protocol [account_ebics](account_ebics/) | 18.0.1.0.1 | | EBICS banking protocol
[account_ebics_batch](account_ebics_batch/) | 18.0.1.0.0 | | EBICS Files automated import and processing [account_ebics_batch](account_ebics_batch/) | 18.0.1.0.0 | | EBICS Files automated import and processing
[account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.0.0 | | Upload Batch Payment via EBICS [account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.0.0 | | Upload Batch Payment via EBICS
[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 18.0.1.0.0 | | Use OCA Bank Statement Import with account_ebics
[account_ebics_oe](account_ebics_oe/) | 18.0.1.0.0 | | Deploy account_ebics module on Odoo Enterprise [account_ebics_oe](account_ebics_oe/) | 18.0.1.0.0 | | Deploy account_ebics module on Odoo Enterprise
[//]: # (end addons) [//]: # (end addons)

View File

@ -1,9 +1,9 @@
# Copyright 2009-2025 Noviat. # Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
{ {
"name": "EBICS banking protocol", "name": "EBICS banking protocol",
"version": "18.0.1.0.0", "version": "18.0.1.0.1",
"license": "LGPL-3", "license": "LGPL-3",
"author": "Noviat", "author": "Noviat",
"website": "https://www.noviat.com/", "website": "https://www.noviat.com/",

View File

@ -209,7 +209,6 @@
<field name="type">up</field> <field name="type">up</field>
<field name="order_type">BTU</field> <field name="order_type">BTU</field>
<field name="description">SEPA credit transfer</field> <field name="description">SEPA credit transfer</field>
<field name="suffix">txt</field>
<field name="btf_service">SCT</field> <field name="btf_service">SCT</field>
<field name="btf_message">pain.001</field> <field name="btf_message">pain.001</field>
<field name="btf_scope">GLB</field> <field name="btf_scope">GLB</field>

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
from odoo import fields, models from odoo import fields, models

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import logging import logging
import os import os

View File

@ -1,5 +1,5 @@
# Copyright 2009-2025 Noviat. # Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import base64 import base64
import logging import logging

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
from odoo import api, fields, models from odoo import api, fields, models

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import base64 import base64
import logging import logging

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import logging import logging
from sys import exc_info from sys import exc_info

View File

@ -1,5 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<record id="ebics_file_format_view_search" model="ir.ui.view">
<field name="name">ebics.file.format.search</field>
<field name="model">ebics.file.format</field>
<field name="arch" type="xml">
<search string="EBICS File Format">
<filter
string="EBICS version 2"
name="ebics_v2"
domain="[('ebics_version', '=', '2')]"
/>
<filter
string="EBICS version 3"
name="ebics_v3"
domain="[('ebics_version', '=', '3')]"
/>
</search>
</field>
</record>
<record id="ebics_file_format_view_list" model="ir.ui.view"> <record id="ebics_file_format_view_list" model="ir.ui.view">
<field name="name">ebics.file.format.list</field> <field name="name">ebics.file.format.list</field>
<field name="model">ebics.file.format</field> <field name="model">ebics.file.format</field>
@ -49,11 +68,11 @@
required="ebics_version == '3'" required="ebics_version == '3'"
invisible="ebics_version == '2'" invisible="ebics_version == '2'"
/> />
<field name="btf_variant" invisible="ebics_version == '2'" />
<field name="btf_version" invisible="ebics_version == '2'" />
<field name="btf_scope" invisible="ebics_version == '2'" /> <field name="btf_scope" invisible="ebics_version == '2'" />
<field name="btf_option" invisible="ebics_version == '2'" /> <field name="btf_option" invisible="ebics_version == '2'" />
<field name="btf_container" invisible="ebics_version == '2'" /> <field name="btf_container" invisible="ebics_version == '2'" />
<field name="btf_version" invisible="ebics_version == '2'" />
<field name="btf_variant" invisible="ebics_version == '2'" />
<field name="btf_format" invisible="ebics_version == '2'" /> <field name="btf_format" invisible="ebics_version == '2'" />
</group> </group>
</group> </group>

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import pprint import pprint

View File

@ -1,5 +1,5 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import logging import logging

View File

@ -1,5 +1,5 @@
# Copyright 2009-2025 Noviat. # Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import base64 import base64
import logging import logging

View File

@ -0,0 +1,17 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3
==========================================================
Deploy account_ebics module with OCA Bank Statement Import
==========================================================
This module makes it possible to use the OCA account_statement_import wizard
in combination with 'account_ebics'.
This module will be installed automatically when following modules are activated
on your odoo database :
- account_ebics
- account_statement_import_file

View File

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

View File

@ -0,0 +1,19 @@
# Copyright 2020-2024 Noviat.
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "account_ebics with OCA Bank Statement Imoort",
"summary": "Use OCA Bank Statement Import with account_ebics",
"version": "18.0.1.0.0",
"author": "Noviat",
"website": "https://www.noviat.com/",
"category": "Hidden",
"license": "LGPL-3",
"depends": [
"account_ebics",
"account_statement_import_file",
],
"installable": True,
"auto_install": True,
"images": ["static/description/cover.png"],
}

View File

@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_ebics_oca_statement_import
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0+e\n"
"Report-Msgid-Bugs-To: \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_ebics_oca_statement_import
#. odoo-python
#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0
#, python-format
msgid "Error detected while processing and EBICS File"
msgstr ""
#. module: account_ebics_oca_statement_import
#: model:ir.model,name:account_ebics_oca_statement_import.model_account_statement_import
msgid "Import Bank Statement Files"
msgstr ""
#. module: account_ebics_oca_statement_import
#. odoo-python
#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0
#, python-format
msgid "Statement %(st_name)s dated %(date)s has already been imported."
msgstr ""
#. module: account_ebics_oca_statement_import
#. odoo-python
#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0
#, python-format
msgid "This file doesn't contain any statement."
msgstr ""
#. module: account_ebics_oca_statement_import
#. odoo-python
#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0
#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0
#, python-format
msgid "This file doesn't contain any transaction."
msgstr ""

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,379 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.20.1: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document">
<a class="reference external image-reference" href="https://www.gnu.org/licenses/lgpl"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a>
<div class="section" id="deploy-account-ebics-module-with-oca-bank-statement-import">
<h1>Deploy account_ebics module with OCA Bank Statement Import</h1>
<p>This module makes it possible to use the OCA account_statement_import wizard
in combination with 'account_ebics'.</p>
<p>This module will be installed automatically when following modules are activated
on your odoo database :</p>
<ul class="simple">
<li>account_ebics</li>
<li>account_statement_import_file</li>
</ul>
</div>
</div>
</body>
</html>

View File

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

View File

@ -0,0 +1,121 @@
# Copyright 2009-2024 Noviat.
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
import logging
from datetime import date, datetime
from odoo import _, models
from odoo.addons.base.models.res_bank import sanitize_account_number
_logger = logging.getLogger(__name__)
class AccountStatementImport(models.TransientModel):
_inherit = "account.statement.import"
def _match_journal(self, account_number, currency):
journal = self.env["account.journal"]
sanitized_account_number = self._sanitize_account_number(account_number)
fin_journals = self.env["account.journal"].search(
[
("type", "=", "bank"),
"|",
("currency_id", "=", currency.id),
("company_id.currency_id", "=", currency.id),
]
)
fin_journal = fin_journals.filtered(
lambda r: sanitized_account_number
in (r.bank_account_id.sanitized_acc_number or "")
)
if len(fin_journal) == 1:
journal = fin_journal
if not journal:
journal = super()._match_journal(account_number, currency)
return journal
def _sanitize_account_number(self, account_number):
sanitized_number = sanitize_account_number(account_number)
check_curr = sanitized_number[-3:]
if check_curr.isalpha():
all_currencies = self.env["res.currency"].search([])
if check_curr in all_currencies.mapped("name"):
sanitized_number = sanitized_number[:-3]
return sanitized_number
def _check_parsed_data(self, stmts_vals):
"""Basic and structural verifications"""
if self.env.context.get("active_model") == "ebics.file":
message = False
if len(stmts_vals) == 0:
message = _("This file doesn't contain any statement.")
if not message:
no_st_line = True
for vals in stmts_vals:
if vals["transactions"] and len(vals["transactions"]) > 0:
no_st_line = False
break
if no_st_line:
message = _("This file doesn't contain any transaction.")
if message:
log_msg = (
_("Error detected while processing and EBICS File")
+ ":\n"
+ message
)
_logger.warning(log_msg)
return
return super()._check_parsed_data(stmts_vals)
def _create_bank_statements(self, stmts_vals, result):
"""
Return error message to ebics.file when handling empty camt.
Remarks/TODO:
We could add more info to the message (e.g. date, balance, ...)
and write this to the ebics.file, note field.
We could also create empty bank statement (in state done) to clearly
show days without transactions via the bank statement list view.
"""
if self.env.context.get("active_model") != "ebics.file":
return super()._create_bank_statements(stmts_vals, result)
else:
messages = []
transactions = False
for st_vals in stmts_vals:
statement_ids = result["statement_ids"][:]
self._set_statement_name(st_vals)
if st_vals.get("transactions"):
transactions = True
super()._create_bank_statements([st_vals], result)
if result["statement_ids"] == statement_ids:
# no statement has been created, this is the case
# when all transactions have been imported already
if isinstance(st_vals["date"], date) or isinstance(
st_vals["date"], datetime
):
st_date = st_vals["date"].strftime("%Y-%m-%d")
else:
st_date = st_vals["date"]
messages.append(
_(
"Statement %(st_name)s dated %(date)s "
"has already been imported.",
st_name=st_vals["name"],
date=st_date,
)
)
if not transactions:
messages.append(_("This file doesn't contain any transaction."))
if messages:
result["notifications"].append(
{"type": "warning", "message": "\n".join(messages)}
)
return
def _set_statement_name(self, st_vals):
"""
Inherit this method to set your own statement naming policy.
"""