From a575cdb6579269e71e533a8ebf7d6f73b2a21217 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Mon, 14 Dec 2020 09:32:49 -0800 Subject: [PATCH] [14.0][MIG]account_ebics --- account_ebics/README.rst | 4 +- account_ebics/__manifest__.py | 2 +- account_ebics/models/ebics_file.py | 23 ++++--- account_ebics/security/ir.model.access.csv | 3 + account_ebics/wizards/__init__.py | 1 - account_ebics/wizards/ebics_xfer.py | 13 ++-- account_ebics/wizards/ebics_xfer.xml | 8 ++- account_ebics_oca_statement_import/README.rst | 17 +++++ .../__init__.py | 1 + .../__manifest__.py | 17 +++++ .../static/description/icon.png | Bin 0 -> 17137 bytes .../wizards/__init__.py | 1 + .../wizards/account_statement_import.py | 62 ++++++++++++++++++ account_ebics_oe/__manifest__.py | 2 +- account_ebics_oe_statement_import/README.rst | 17 +++++ account_ebics_oe_statement_import/__init__.py | 1 + .../__manifest__.py | 17 +++++ .../static/description/icon.png | Bin 0 -> 17137 bytes .../wizards/__init__.py | 1 + .../wizards/account_bank_statement_import.py | 0 20 files changed, 163 insertions(+), 27 deletions(-) create mode 100644 account_ebics_oca_statement_import/README.rst create mode 100644 account_ebics_oca_statement_import/__init__.py create mode 100644 account_ebics_oca_statement_import/__manifest__.py create mode 100644 account_ebics_oca_statement_import/static/description/icon.png create mode 100644 account_ebics_oca_statement_import/wizards/__init__.py create mode 100644 account_ebics_oca_statement_import/wizards/account_statement_import.py create mode 100644 account_ebics_oe_statement_import/README.rst create mode 100644 account_ebics_oe_statement_import/__init__.py create mode 100644 account_ebics_oe_statement_import/__manifest__.py create mode 100644 account_ebics_oe_statement_import/static/description/icon.png create mode 100644 account_ebics_oe_statement_import/wizards/__init__.py rename {account_ebics => account_ebics_oe_statement_import}/wizards/account_bank_statement_import.py (100%) diff --git a/account_ebics/README.rst b/account_ebics/README.rst index 170918d..e5e5d5d 100644 --- a/account_ebics/README.rst +++ b/account_ebics/README.rst @@ -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. - Cf. https://github.com/OCA/l10n_fr + Cf. https://github.com/OCA/l10n_france | diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index 2a428e6..9ce48bf 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'EBICS banking protocol', - 'version': '13.0.1.3.0', + 'version': '14.0.1.0.0', 'license': 'LGPL-3', 'author': 'Noviat', 'website': 'www.noviat.com', diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 80dabf2..d20bf4c 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -103,8 +103,8 @@ class EbicsFile(models.Model): def action_open_bank_statements(self): self.ensure_one() - action = self.env['ir.actions.act_window'].for_xml_id( - 'account', 'action_bank_statement_tree') + action = self.env['ir.actions.act_window']._for_xml_id( + 'account.action_bank_statement_tree') domain = eval(action.get('domain') or '[]') domain += [('id', 'in', self._context.get('statement_ids'))] action.update({'domain': domain}) @@ -220,12 +220,12 @@ class EbicsFile(models.Model): We do not support the standard _journal_creation_wizard since a single 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) - wiz_model = 'account.bank.statement.import' + wiz_model = 'account.statement.import' data_file = base64.b64decode(self.data) lines = data_file.split(b'\n') - attachments_vals = [] + wiz_vals_list = [] st_lines = b'' transactions = False for line in lines: @@ -237,10 +237,9 @@ class EbicsFile(models.Model): if rec_type == b'07': if transactions: fn = '_'.join([acc_number.decode(), self.name]) - attachments_vals.append({ - 'name': fn, - 'store_fname': fn, - 'datas': base64.b64encode(st_lines) + wiz_vals_list.append({ + 'statement_filename': fn, + 'statement_file': base64.b64encode(st_lines) }) st_lines = b'' transactions = False @@ -252,10 +251,9 @@ class EbicsFile(models.Model): 'notifications': []}, } wiz_ctx = dict(self.env.context, active_model='ebics.file') - for i, attachment_vals in enumerate(attachments_vals, start=1): - wiz_vals = {'attachment_ids': [(0, 0, attachment_vals)]} + for i, wiz_vals in enumerate(wiz_vals_list, start=1): 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') if (res.get('res_model') == 'account.bank.statement.import.journal.creation'): @@ -272,6 +270,7 @@ class EbicsFile(models.Model): 'details': details, }]) continue + import pdb; pdb.set_trace() result['context']['statement_line_ids'].extend( ctx['statement_line_ids']) result['context']['notifications'].extend( diff --git a/account_ebics/security/ir.model.access.csv b/account_ebics/security/ir.model.access.csv index 3d71939..9c2ae17 100644 --- a/account_ebics/security/ir.model.access.csv +++ b/account_ebics/security/ir.model.access.csv @@ -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_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_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 diff --git a/account_ebics/wizards/__init__.py b/account_ebics/wizards/__init__.py index 944b9c8..b66b034 100644 --- a/account_ebics/wizards/__init__.py +++ b/account_ebics/wizards/__init__.py @@ -1,3 +1,2 @@ -from . import account_bank_statement_import from . import ebics_change_passphrase from . import ebics_xfer diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index f31df5f..dd8173a 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -66,6 +66,9 @@ class EbicsXfer(models.TransientModel): string='EBICS File Format', help="Select EBICS File Format to upload/download." "\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( related='format_id.order_type', string='Order Type', @@ -94,14 +97,11 @@ class EbicsXfer(models.TransientModel): @api.onchange('ebics_config_id') def _onchange_ebics_config_id(self): ebics_userids = self.ebics_config_id.ebics_userid_ids - domain = {'ebics_userid_id': [('id', 'in', ebics_userids.ids)]} if self._context.get('ebics_download'): download_formats = self.ebics_config_id.ebics_file_format_ids\ .filtered(lambda r: r.type == 'down') if len(download_formats) == 1: self.format_id = download_formats - domain['format_id'] = [('type', '=', 'down'), - ('id', 'in', download_formats.ids)] if len(ebics_userids) == 1: self.ebics_userid_id = ebics_userids else: @@ -114,11 +114,8 @@ class EbicsXfer(models.TransientModel): .filtered(lambda r: r.type == 'up') if len(upload_formats) == 1: self.format_id = upload_formats - domain['format_id'] = [('type', '=', 'up'), - ('id', 'in', upload_formats.ids)] if len(ebics_userids) == 1: self.ebics_userid_id = ebics_userids - return {'domain': domain} @api.onchange('upload_data') def _onchange_upload_data(self): @@ -262,8 +259,8 @@ class EbicsXfer(models.TransientModel): def view_ebics_file(self): self.ensure_one() module = __name__.split('addons.')[1].split('.')[0] - act = self.env['ir.actions.act_window'].for_xml_id( - module, 'ebics_file_action_download') + act = self.env['ir.actions.act_window']._for_xml_id( + '{}.ebics_file_action_download'.format(module)) act['domain'] = [('id', 'in', self._context['ebics_file_ids'])] return act diff --git a/account_ebics/wizards/ebics_xfer.xml b/account_ebics/wizards/ebics_xfer.xml index 60b5369..091c08b 100644 --- a/account_ebics/wizards/ebics_xfer.xml +++ b/account_ebics/wizards/ebics_xfer.xml @@ -16,8 +16,10 @@ options="{'no_create': True, 'no_open': True}"/> - + +