mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-07-01 19:25:40 +00:00
[t162272] Merge remote-tracking branch 'source/17.0_tmp' into 18.0.t162272
Migrated modules: ['account_ebics_oca_statement_import']
This commit is contained in:
commit
54c848eced
17
account_ebics_oca_statement_import/README.rst
Normal file
17
account_ebics_oca_statement_import/README.rst
Normal 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
|
||||
|
1
account_ebics_oca_statement_import/__init__.py
Normal file
1
account_ebics_oca_statement_import/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from . import wizards
|
19
account_ebics_oca_statement_import/__manifest__.py
Normal file
19
account_ebics_oca_statement_import/__manifest__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright 2020-2024 Noviat.
|
||||
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
{
|
||||
"name": "account_ebics with OCA Bank Statement Imoort",
|
||||
"summary": "Use OCA Bank Statement Import with account_ebics",
|
||||
"version": "17.0.1.0.1",
|
||||
"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"],
|
||||
}
|
@ -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 ""
|
3
account_ebics_oca_statement_import/pyproject.toml
Normal file
3
account_ebics_oca_statement_import/pyproject.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
BIN
account_ebics_oca_statement_import/static/description/cover.png
Normal file
BIN
account_ebics_oca_statement_import/static/description/cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 310 KiB |
BIN
account_ebics_oca_statement_import/static/description/icon.png
Normal file
BIN
account_ebics_oca_statement_import/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
379
account_ebics_oca_statement_import/static/description/index.html
Normal file
379
account_ebics_oca_statement_import/static/description/index.html
Normal 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>
|
1
account_ebics_oca_statement_import/wizards/__init__.py
Normal file
1
account_ebics_oca_statement_import/wizards/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from . import account_statement_import
|
@ -0,0 +1,121 @@
|
||||
# Copyright 2009-2024 Noviat.
|
||||
# License LGPL-3 or later (http://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.
|
||||
"""
|
Loading…
x
Reference in New Issue
Block a user