[MIG] account_statement_import_file_reconcile_oca to v16

The module was ported from v14. It was renamed from
account_statement_import_file_reconciliation_widget to
account_statement_import_file_reconcile_oca to take into account the new
names of the modules it depend on.

Update code to the new notification system.
This commit is contained in:
Alexis de Lattre
2023-03-06 22:53:15 +01:00
parent dd77ec0ca0
commit d05e5ae79a
19 changed files with 51 additions and 33 deletions

View File

@@ -5,9 +5,9 @@
{
"name": "Import Statement Files and Go Direct to Reconciliation",
"category": "Accounting",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": ["account_statement_import", "account_reconciliation_widget"],
"depends": ["account_statement_import_file", "account_reconcile_oca"],
"author": "Akretion, Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/bank-statement-import",

View File

@@ -1,9 +1,9 @@
This module is a glue module between 2 modules:
* **account_statement_import** from the Github project *OCA/bank-statement-import*
* **account_reconciliation_widget** from the Github project `OCA/account-reconcile <https://github.com/OCA/account-reconcile>`_
* **account_statement_import_file** from the Github project *OCA/bank-statement-import*
* **account_reconcile_oca** from the Github project `OCA/account-reconcile <https://github.com/OCA/account-reconcile>`_
This module adds a button **Import and Start to Reconcile** on the bank statement file import wizard. When you click on this button, Odoo will import the bank statement file and jump directly to the special reconciliation interface.
This module adds a button **Import and Start to Reconcile** on the bank statement file import wizard. When you click on this button, Odoo will import the bank statement file and jump directly to the reconciliation interface.
.. figure:: ../static/description/bank_statement_import_start_reconcile.png
:alt: Bank statement import wizard screenshot

View File

@@ -0,0 +1 @@
This module will be installed automatically by Odoo if the modules **account_statement_import_file** and **account_reconcile_oca** are installed.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,37 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# Licence AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0).
from odoo import models
class AccountStatementImport(models.TransientModel):
_inherit = "account.statement.import"
def import_file_and_reconcile_button(self):
"""Process the file chosen in the wizard, create bank statement(s)
and jump directly to the reconciliation widget"""
result = self._import_file()
self.env["account.bank.statement"].browse(result["statement_ids"])
action = self.env["ir.actions.actions"]._for_xml_id(
"account_reconcile_oca.action_bank_statement_line_reconcile"
)
action["context"] = {
"default_journal_id": self._context.get("journal_id"),
"active_id": self._context.get("journal_id"),
"search_default_not_reconciled": True,
"view_ref": "account_reconcile_oca.bank_statement_line_form_reconcile_view",
}
if result["notifications"]:
action_with_notif = {
"type": "ir.actions.client",
"tag": "display_notification",
"params": {
"type": "warning",
"sticky": True,
"message": "\n\n".join(result["notifications"]),
"next": action,
},
}
return action_with_notif
return action

View File

@@ -10,7 +10,7 @@
<field name="model">account.statement.import</field>
<field
name="inherit_id"
ref="account_statement_import.account_statement_import_form"
ref="account_statement_import_file.account_statement_import_form"
/>
<field name="arch" type="xml">
<button name="import_file_button" position="before">

View File

@@ -1 +0,0 @@
This module will be installed automatically by Odoo if the modules **account_statement_import** and **account_reconciliation_widget** are installed.

View File

@@ -1,26 +0,0 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# Licence AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0).
from odoo import models
class AccountStatementImport(models.TransientModel):
_inherit = "account.statement.import"
def import_file_and_reconcile_button(self):
"""Process the file chosen in the wizard, create bank statement(s)
and jump directly to the reconcilition widget"""
result = self._import_file()
statements = self.env["account.bank.statement"].browse(result["statement_ids"])
statements.button_post()
action = {
"type": "ir.actions.client",
"tag": "bank_statement_reconciliation_view",
"context": {
"statement_line_ids": statements.line_ids.ids,
"company_ids": statements.company_id.ids,
"notifications": result["notifications"],
},
}
return action

View File

@@ -0,0 +1 @@
../../../../account_statement_import_file_reconcile_oca

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)