Files
bank-statement-import/account_statement_import/account_journal.py
Odoo SA b47eb66eb0 Import account_bank_statement_import by Odoo SA
Import code just before commit 9ba8734f15e1a292ca27b1a026e8366a91b2a8c9
that moved the module account_bank_statement_import to Odoo Enterprise
Only modifications :
- add author (Odoo SA) and license (LGPL) keys in manifest
- add copyright headers Odoo SA all main files
2021-01-07 09:17:47 +01:00

32 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2004-2020 Odoo S.A.
# Licence LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0).
from odoo import models, api, _
class AccountJournal(models.Model):
_inherit = "account.journal"
def _get_bank_statements_available_import_formats(self):
""" Returns a list of strings representing the supported import formats.
"""
return []
def __get_bank_statements_available_sources(self):
rslt = super(AccountJournal, self).__get_bank_statements_available_sources()
formats_list = self._get_bank_statements_available_import_formats()
if formats_list:
formats_list.sort()
import_formats_str = ', '.join(formats_list)
rslt.append(("file_import", _("Import") + "(" + import_formats_str + ")"))
return rslt
def import_statement(self):
"""return action to import bank/cash statements. This button should be called only on journals with type =='bank'"""
action_name = 'action_account_bank_statement_import'
[action] = self.env.ref('account_bank_statement_import.%s' % action_name).read()
# Note: this drops action['context'], which is a dict stored as a string, which is not easy to update
action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")})
return action