mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[MIG] account_bank_statement_import to v14 > account_statement_import
Module renamed to account_statement_import to avoid conflit with Odoo enterprise Add support for multi-account statement files Integrate the feature provided by the module account_bank_statement_import_save_file Improve error messages Remove dead or annoying features Improve code !
This commit is contained in:
committed by
Pedro M. Baeza
parent
d126f8192a
commit
f752e3bc17
2
account_statement_import/models/__init__.py
Normal file
2
account_statement_import/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import account_journal
|
||||
from . import account_bank_statement_line
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright 2004-2020 Odoo S.A.
|
||||
# Copyright 2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Licence LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountBankStatementLine(models.Model):
|
||||
_inherit = "account.bank.statement.line"
|
||||
|
||||
# Ensure transactions can be imported only once
|
||||
# (if the import format provides unique transaction ids)
|
||||
unique_import_id = fields.Char(string="Import ID", readonly=True, copy=False)
|
||||
# v13 field: bank_partner_id
|
||||
# This field was removed in v14, but it is still used in the code, cf the
|
||||
# method reconcile() !!! So I restore the field here
|
||||
partner_bank_id = fields.Many2one("res.partner.bank", string="Partner Bank Account")
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
"unique_import_id",
|
||||
"unique(unique_import_id)",
|
||||
"A bank account transaction can be imported only once!",
|
||||
)
|
||||
]
|
||||
32
account_statement_import/models/account_journal.py
Normal file
32
account_statement_import/models/account_journal.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2004-2020 Odoo S.A.
|
||||
# Copyright 2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Licence LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0).
|
||||
|
||||
from odoo import _, models
|
||||
|
||||
|
||||
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().__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 = self.env.ref(
|
||||
"account_statement_import.account_statement_import_action"
|
||||
).read()[0]
|
||||
action["context"] = {"journal_id": self.id}
|
||||
return action
|
||||
Reference in New Issue
Block a user