mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[ADD] module account_statement_import_file_reconciliation_widget
account_statement_import_file_reconciliation_widget is a glue auto-install module between account_statement_import (will be renamed account_statement_import_file in v16) and account_reconciliation_widget.
This commit is contained in:
@@ -24,9 +24,7 @@ class AccountStatementImport(models.TransientModel):
|
||||
)
|
||||
statement_filename = fields.Char()
|
||||
|
||||
def import_file_button(self):
|
||||
"""Process the file chosen in the wizard, create bank statement(s)
|
||||
and return an action."""
|
||||
def _import_file(self):
|
||||
self.ensure_one()
|
||||
result = {
|
||||
"statement_ids": [],
|
||||
@@ -44,9 +42,14 @@ class AccountStatementImport(models.TransientModel):
|
||||
)
|
||||
)
|
||||
self.env["ir.attachment"].create(self._prepare_create_attachment(result))
|
||||
if self.env.context.get("return_regular_interface_action"):
|
||||
action = (
|
||||
self.env.ref("account.action_bank_statement_tree").sudo().read([])[0]
|
||||
return result
|
||||
|
||||
def import_file_button(self):
|
||||
"""Process the file chosen in the wizard, create bank statement(s)
|
||||
and return an action."""
|
||||
result = self._import_file()
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"account.action_bank_statement_tree"
|
||||
)
|
||||
if len(result["statement_ids"]) == 1:
|
||||
action.update(
|
||||
@@ -58,20 +61,6 @@ class AccountStatementImport(models.TransientModel):
|
||||
)
|
||||
else:
|
||||
action["domain"] = [("id", "in", result["statement_ids"])]
|
||||
else:
|
||||
# dispatch to reconciliation interface
|
||||
lines = self.env["account.bank.statement.line"].search(
|
||||
[("statement_id", "in", result["statement_ids"])]
|
||||
)
|
||||
action = {
|
||||
"type": "ir.actions.client",
|
||||
"tag": "bank_statement_reconciliation_view",
|
||||
"context": {
|
||||
"statement_line_ids": lines.ids,
|
||||
"company_ids": self.env.user.company_ids.ids,
|
||||
"notifications": result["notifications"],
|
||||
},
|
||||
}
|
||||
return action
|
||||
|
||||
def _prepare_create_attachment(self, result):
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
<footer>
|
||||
<button
|
||||
name="import_file_button"
|
||||
string="Import"
|
||||
string="Import and View"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
context="{'return_regular_interface_action': True}"
|
||||
/> <!-- The context may be temporary... waiting for the port of the reconcile interface -->
|
||||
/>
|
||||
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
|
||||
@@ -21,16 +21,6 @@
|
||||
<field name="sequence" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<!--
|
||||
I don't see anything interesting in the 'ref' field of the
|
||||
move linked to the statement line
|
||||
and the field move_id is displayed in the view.
|
||||
But if you think it's useful to see this field,
|
||||
don't hesitate to remove the 2 lines below
|
||||
-->
|
||||
<field name="ref" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="narration" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Will be auto-generated from the readme subdir
|
||||
@@ -0,0 +1 @@
|
||||
from . import wizards
|
||||
@@ -0,0 +1,19 @@
|
||||
# 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).
|
||||
|
||||
{
|
||||
"name": "Import Statement Files and Go Direct to Reconciliation",
|
||||
"category": "Accounting",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["account_statement_import", "account_reconciliation_widget"],
|
||||
"author": "Akretion, Odoo Community Association (OCA)",
|
||||
"maintainers": ["alexis-via"],
|
||||
"website": "https://github.com/OCA/bank-statement-import",
|
||||
"data": [
|
||||
"wizards/account_statement_import_view.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"auto_install": True,
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@@ -0,0 +1,9 @@
|
||||
This module is a glue module between 2 modules:
|
||||
|
||||
* **account_statement_import** from `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import>`_
|
||||
* **account_reconciliation_widget** from `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.
|
||||
|
||||
.. figure:: ../static/description/bank_statement_import_start_reconcile.png
|
||||
:alt: Bank statement import wizard screenshot
|
||||
@@ -0,0 +1 @@
|
||||
This module will be installed automatically by Odoo if the modules **account_statement_import** and **account_reconciliation_widget** are installed.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1 @@
|
||||
from . import account_statement_import
|
||||
@@ -0,0 +1,26 @@
|
||||
# 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
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.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).
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="account_statement_import_form" model="ir.ui.view">
|
||||
<field name="model">account.statement.import</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_statement_import.account_statement_import_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="import_file_button" position="before">
|
||||
<button
|
||||
name="import_file_and_reconcile_button"
|
||||
string="Import and Start to Reconcile"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1 @@
|
||||
../../../../account_statement_import_file_reconciliation_widget
|
||||
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user