mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-22 20:22:03 +00:00
[14.0][MIG]account_ebics
This commit is contained in:
parent
eba176dea8
commit
a575cdb657
@ -51,11 +51,11 @@ We also recommend to consider the installation of the following modules:
|
|||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
- account_bank_statement_import_fr_cfonb
|
- account_statement_import_fr_cfonb
|
||||||
|
|
||||||
Required to handle french CFONB files.
|
Required to handle french CFONB files.
|
||||||
|
|
||||||
Cf. https://github.com/OCA/l10n_fr
|
Cf. https://github.com/OCA/l10n_france
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'EBICS banking protocol',
|
'name': 'EBICS banking protocol',
|
||||||
'version': '13.0.1.3.0',
|
'version': '14.0.1.0.0',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'author': 'Noviat',
|
'author': 'Noviat',
|
||||||
'website': 'www.noviat.com',
|
'website': 'www.noviat.com',
|
||||||
|
@ -103,8 +103,8 @@ class EbicsFile(models.Model):
|
|||||||
|
|
||||||
def action_open_bank_statements(self):
|
def action_open_bank_statements(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
action = self.env['ir.actions.act_window']._for_xml_id(
|
||||||
'account', 'action_bank_statement_tree')
|
'account.action_bank_statement_tree')
|
||||||
domain = eval(action.get('domain') or '[]')
|
domain = eval(action.get('domain') or '[]')
|
||||||
domain += [('id', 'in', self._context.get('statement_ids'))]
|
domain += [('id', 'in', self._context.get('statement_ids'))]
|
||||||
action.update({'domain': domain})
|
action.update({'domain': domain})
|
||||||
@ -220,12 +220,12 @@ class EbicsFile(models.Model):
|
|||||||
We do not support the standard _journal_creation_wizard since a single
|
We do not support the standard _journal_creation_wizard since a single
|
||||||
cfonb120 file may contain statements from different legal entities.
|
cfonb120 file may contain statements from different legal entities.
|
||||||
"""
|
"""
|
||||||
import_module = 'account_bank_statement_import_fr_cfonb'
|
import_module = 'account_statement_import_fr_cfonb'
|
||||||
self._check_import_module(import_module)
|
self._check_import_module(import_module)
|
||||||
wiz_model = 'account.bank.statement.import'
|
wiz_model = 'account.statement.import'
|
||||||
data_file = base64.b64decode(self.data)
|
data_file = base64.b64decode(self.data)
|
||||||
lines = data_file.split(b'\n')
|
lines = data_file.split(b'\n')
|
||||||
attachments_vals = []
|
wiz_vals_list = []
|
||||||
st_lines = b''
|
st_lines = b''
|
||||||
transactions = False
|
transactions = False
|
||||||
for line in lines:
|
for line in lines:
|
||||||
@ -237,10 +237,9 @@ class EbicsFile(models.Model):
|
|||||||
if rec_type == b'07':
|
if rec_type == b'07':
|
||||||
if transactions:
|
if transactions:
|
||||||
fn = '_'.join([acc_number.decode(), self.name])
|
fn = '_'.join([acc_number.decode(), self.name])
|
||||||
attachments_vals.append({
|
wiz_vals_list.append({
|
||||||
'name': fn,
|
'statement_filename': fn,
|
||||||
'store_fname': fn,
|
'statement_file': base64.b64encode(st_lines)
|
||||||
'datas': base64.b64encode(st_lines)
|
|
||||||
})
|
})
|
||||||
st_lines = b''
|
st_lines = b''
|
||||||
transactions = False
|
transactions = False
|
||||||
@ -252,10 +251,9 @@ class EbicsFile(models.Model):
|
|||||||
'notifications': []},
|
'notifications': []},
|
||||||
}
|
}
|
||||||
wiz_ctx = dict(self.env.context, active_model='ebics.file')
|
wiz_ctx = dict(self.env.context, active_model='ebics.file')
|
||||||
for i, attachment_vals in enumerate(attachments_vals, start=1):
|
for i, wiz_vals in enumerate(wiz_vals_list, start=1):
|
||||||
wiz_vals = {'attachment_ids': [(0, 0, attachment_vals)]}
|
|
||||||
wiz = self.env[wiz_model].with_context(wiz_ctx).create(wiz_vals)
|
wiz = self.env[wiz_model].with_context(wiz_ctx).create(wiz_vals)
|
||||||
res = wiz.import_file()
|
res = wiz.import_file_button()
|
||||||
ctx = res.get('context')
|
ctx = res.get('context')
|
||||||
if (res.get('res_model')
|
if (res.get('res_model')
|
||||||
== 'account.bank.statement.import.journal.creation'):
|
== 'account.bank.statement.import.journal.creation'):
|
||||||
@ -272,6 +270,7 @@ class EbicsFile(models.Model):
|
|||||||
'details': details,
|
'details': details,
|
||||||
}])
|
}])
|
||||||
continue
|
continue
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
result['context']['statement_line_ids'].extend(
|
result['context']['statement_line_ids'].extend(
|
||||||
ctx['statement_line_ids'])
|
ctx['statement_line_ids'])
|
||||||
result['context']['notifications'].extend(
|
result['context']['notifications'].extend(
|
||||||
|
@ -7,3 +7,6 @@ access_ebics_file_format_manager,ebics_file_format manager,model_ebics_file_form
|
|||||||
access_ebics_file_format_user,ebics_file_format user,model_ebics_file_format,account.group_account_invoice,1,0,0,0
|
access_ebics_file_format_user,ebics_file_format user,model_ebics_file_format,account.group_account_invoice,1,0,0,0
|
||||||
access_ebics_file_manager,ebics_file manager,model_ebics_file,group_ebics_manager,1,1,1,1
|
access_ebics_file_manager,ebics_file manager,model_ebics_file,group_ebics_manager,1,1,1,1
|
||||||
access_ebics_file_user,ebics_file user,model_ebics_file,account.group_account_invoice,1,1,1,0
|
access_ebics_file_user,ebics_file user,model_ebics_file,account.group_account_invoice,1,1,1,0
|
||||||
|
|
||||||
|
access_ebics_change_passphrase,access_ebics_change_passphrase,model_ebics_change_passphrase,group_ebics_manager,1,1,1,0
|
||||||
|
access_ebics_xfer,access_ebics_xfer,model_ebics_xfer,account.group_account_invoice,1,1,1,0
|
||||||
|
|
@ -1,3 +1,2 @@
|
|||||||
from . import account_bank_statement_import
|
|
||||||
from . import ebics_change_passphrase
|
from . import ebics_change_passphrase
|
||||||
from . import ebics_xfer
|
from . import ebics_xfer
|
||||||
|
@ -66,6 +66,9 @@ class EbicsXfer(models.TransientModel):
|
|||||||
string='EBICS File Format',
|
string='EBICS File Format',
|
||||||
help="Select EBICS File Format to upload/download."
|
help="Select EBICS File Format to upload/download."
|
||||||
"\nLeave blank to download all available files.")
|
"\nLeave blank to download all available files.")
|
||||||
|
allowed_format_ids = fields.Many2many(
|
||||||
|
related='ebics_config_id.ebics_file_format_ids',
|
||||||
|
string='Allowed EBICS File Formats')
|
||||||
order_type = fields.Char(
|
order_type = fields.Char(
|
||||||
related='format_id.order_type',
|
related='format_id.order_type',
|
||||||
string='Order Type',
|
string='Order Type',
|
||||||
@ -94,14 +97,11 @@ class EbicsXfer(models.TransientModel):
|
|||||||
@api.onchange('ebics_config_id')
|
@api.onchange('ebics_config_id')
|
||||||
def _onchange_ebics_config_id(self):
|
def _onchange_ebics_config_id(self):
|
||||||
ebics_userids = self.ebics_config_id.ebics_userid_ids
|
ebics_userids = self.ebics_config_id.ebics_userid_ids
|
||||||
domain = {'ebics_userid_id': [('id', 'in', ebics_userids.ids)]}
|
|
||||||
if self._context.get('ebics_download'):
|
if self._context.get('ebics_download'):
|
||||||
download_formats = self.ebics_config_id.ebics_file_format_ids\
|
download_formats = self.ebics_config_id.ebics_file_format_ids\
|
||||||
.filtered(lambda r: r.type == 'down')
|
.filtered(lambda r: r.type == 'down')
|
||||||
if len(download_formats) == 1:
|
if len(download_formats) == 1:
|
||||||
self.format_id = download_formats
|
self.format_id = download_formats
|
||||||
domain['format_id'] = [('type', '=', 'down'),
|
|
||||||
('id', 'in', download_formats.ids)]
|
|
||||||
if len(ebics_userids) == 1:
|
if len(ebics_userids) == 1:
|
||||||
self.ebics_userid_id = ebics_userids
|
self.ebics_userid_id = ebics_userids
|
||||||
else:
|
else:
|
||||||
@ -114,11 +114,8 @@ class EbicsXfer(models.TransientModel):
|
|||||||
.filtered(lambda r: r.type == 'up')
|
.filtered(lambda r: r.type == 'up')
|
||||||
if len(upload_formats) == 1:
|
if len(upload_formats) == 1:
|
||||||
self.format_id = upload_formats
|
self.format_id = upload_formats
|
||||||
domain['format_id'] = [('type', '=', 'up'),
|
|
||||||
('id', 'in', upload_formats.ids)]
|
|
||||||
if len(ebics_userids) == 1:
|
if len(ebics_userids) == 1:
|
||||||
self.ebics_userid_id = ebics_userids
|
self.ebics_userid_id = ebics_userids
|
||||||
return {'domain': domain}
|
|
||||||
|
|
||||||
@api.onchange('upload_data')
|
@api.onchange('upload_data')
|
||||||
def _onchange_upload_data(self):
|
def _onchange_upload_data(self):
|
||||||
@ -262,8 +259,8 @@ class EbicsXfer(models.TransientModel):
|
|||||||
def view_ebics_file(self):
|
def view_ebics_file(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
module = __name__.split('addons.')[1].split('.')[0]
|
module = __name__.split('addons.')[1].split('.')[0]
|
||||||
act = self.env['ir.actions.act_window'].for_xml_id(
|
act = self.env['ir.actions.act_window']._for_xml_id(
|
||||||
module, 'ebics_file_action_download')
|
'{}.ebics_file_action_download'.format(module))
|
||||||
act['domain'] = [('id', 'in', self._context['ebics_file_ids'])]
|
act['domain'] = [('id', 'in', self._context['ebics_file_ids'])]
|
||||||
return act
|
return act
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
options="{'no_create': True, 'no_open': True}"/>
|
options="{'no_create': True, 'no_open': True}"/>
|
||||||
<field name="date_from"/>
|
<field name="date_from"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to"/>
|
||||||
<field name="format_id"/>
|
<field name="format_id"
|
||||||
|
domain="[('type', '=', 'down'), ('id', 'in', allowed_format_ids)]"/>
|
||||||
<field name="order_type"/>
|
<field name="order_type"/>
|
||||||
|
<field name="allowed_format_ids" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="ebics_download" string="Download Files" type="object" class="oe_highlight"/>
|
<button name="ebics_download" string="Download Files" type="object" class="oe_highlight"/>
|
||||||
@ -45,9 +47,11 @@
|
|||||||
<field name="upload_data" filename="upload_fname" required="1"/>
|
<field name="upload_data" filename="upload_fname" required="1"/>
|
||||||
<field name="upload_fname" invisible="1"/>
|
<field name="upload_fname" invisible="1"/>
|
||||||
<field name="upload_fname_dummy"/>
|
<field name="upload_fname_dummy"/>
|
||||||
<field name="format_id" required="1"/>
|
<field name="format_id" required="1"
|
||||||
|
domain="[('type', '=', 'up'), ('id', 'in', allowed_format_ids)]"/>
|
||||||
<field name="order_type"/>
|
<field name="order_type"/>
|
||||||
<field name="test_mode" attrs="{'invisible': [('order_type', '!=', 'FUL')]}"/>
|
<field name="test_mode" attrs="{'invisible': [('order_type', '!=', 'FUL')]}"/>
|
||||||
|
<field name="allowed_format_ids" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="ebics_upload" string="Upload File" type="object" class="oe_highlight"/>
|
<button name="ebics_upload" string="Upload File" type="object" class="oe_highlight"/>
|
||||||
|
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 OCA account_statement_import
|
||||||
|
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
|
||||||
|
|
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
|
17
account_ebics_oca_statement_import/__manifest__.py
Normal file
17
account_ebics_oca_statement_import/__manifest__.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2020 Noviat.
|
||||||
|
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'account_ebics with OCA Bank Statement Imoort',
|
||||||
|
'summary': "Use OCA Bank Statement Import with account_ebics",
|
||||||
|
'version': '14.0.1.0.0',
|
||||||
|
'author': 'Noviat',
|
||||||
|
'category': 'Hidden',
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'depends': [
|
||||||
|
'account_ebics',
|
||||||
|
'account_statement_import',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': True,
|
||||||
|
}
|
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 |
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,62 @@
|
|||||||
|
# Copyright 2009-2020 Noviat.
|
||||||
|
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from odoo import models, _
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class AccountStatementImport(models.TransientModel):
|
||||||
|
_inherit = 'account.statement.import'
|
||||||
|
|
||||||
|
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.warn(log_msg)
|
||||||
|
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':
|
||||||
|
transactions = False
|
||||||
|
for st_vals in stmts_vals:
|
||||||
|
if st_vals.get('transactions'):
|
||||||
|
transactions = True
|
||||||
|
break
|
||||||
|
if not transactions:
|
||||||
|
message = _('This file doesn\'t contain any transaction.')
|
||||||
|
statement_ids = []
|
||||||
|
notifications = {
|
||||||
|
'type': 'warning',
|
||||||
|
'message': message,
|
||||||
|
'details': ''
|
||||||
|
}
|
||||||
|
return st_line_ids, [notifications]
|
||||||
|
|
||||||
|
return super()._create_bank_statements(stmts_vals, result)
|
@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'account_ebics on Odoo Enterprise',
|
'name': 'account_ebics on Odoo Enterprise',
|
||||||
'summary': "Deploy account_ebics module on Odoo Enterprise",
|
'summary': "Deploy account_ebics module on Odoo Enterprise",
|
||||||
'version': '13.0.1.0.0',
|
'version': '14.0.1.0.0',
|
||||||
'author': 'Noviat',
|
'author': 'Noviat',
|
||||||
'category': 'Hidden',
|
'category': 'Hidden',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
|
17
account_ebics_oe_statement_import/README.rst
Normal file
17
account_ebics_oe_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 Odoo Enterprise Bank Statement Import
|
||||||
|
======================================================================
|
||||||
|
|
||||||
|
This module makes it possible to use Odoo Enterprise account_bank_statement_import
|
||||||
|
in combination with 'account_ebics'.
|
||||||
|
|
||||||
|
This module will be installed automatically when following modules are activated
|
||||||
|
on your odoo database :
|
||||||
|
|
||||||
|
- account_ebics_oe
|
||||||
|
- account_bank_statement_import
|
||||||
|
|
1
account_ebics_oe_statement_import/__init__.py
Normal file
1
account_ebics_oe_statement_import/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import wizards
|
17
account_ebics_oe_statement_import/__manifest__.py
Normal file
17
account_ebics_oe_statement_import/__manifest__.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2020 Noviat.
|
||||||
|
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'account_ebics with Odoo Enterprise Bank Statement Import',
|
||||||
|
'summary': "Use Odoo Enterprise Bank Statement Import with account_ebics",
|
||||||
|
'version': '14.0.1.0.0',
|
||||||
|
'author': 'Noviat',
|
||||||
|
'category': 'Hidden',
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'depends': [
|
||||||
|
'account_ebics_oe',
|
||||||
|
'account_bank_statement_import',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': True,
|
||||||
|
}
|
BIN
account_ebics_oe_statement_import/static/description/icon.png
Normal file
BIN
account_ebics_oe_statement_import/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
1
account_ebics_oe_statement_import/wizards/__init__.py
Normal file
1
account_ebics_oe_statement_import/wizards/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import account_bank_statement_import
|
Loading…
Reference in New Issue
Block a user