flectra/addons/account_bank_statement_import/account_journal.py
flectra-admin 769eafb483 [INIT] Inception of Flectra from Odoo
Flectra is Forked from Odoo v11 commit : (6135e82d73)
2018-01-16 11:45:59 +05:30

19 lines
762 B
Python

# -*- coding: utf-8 -*-
from odoo import models, fields, api
class AccountJournal(models.Model):
_inherit = "account.journal"
bank_statements_source = fields.Selection(selection_add=[("file_import", "File Import")])
@api.multi
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