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:
committed by
Miquel Raïch
parent
193b1faa76
commit
bf8bf2eb9c
@@ -23,9 +23,7 @@ class AccountStatementImport(models.TransientModel):
|
|||||||
)
|
)
|
||||||
statement_filename = fields.Char()
|
statement_filename = fields.Char()
|
||||||
|
|
||||||
def import_file_button(self):
|
def _import_file(self):
|
||||||
"""Process the file chosen in the wizard, create bank statement(s)
|
|
||||||
and return an action."""
|
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
result = {
|
result = {
|
||||||
"statement_ids": [],
|
"statement_ids": [],
|
||||||
@@ -43,34 +41,25 @@ class AccountStatementImport(models.TransientModel):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.env["ir.attachment"].create(self._prepare_create_attachment(result))
|
self.env["ir.attachment"].create(self._prepare_create_attachment(result))
|
||||||
if self.env.context.get("return_regular_interface_action"):
|
return result
|
||||||
action = (
|
|
||||||
self.env.ref("account.action_bank_statement_tree").sudo().read([])[0]
|
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(
|
||||||
|
{
|
||||||
|
"view_mode": "form,tree",
|
||||||
|
"views": False,
|
||||||
|
"res_id": result["statement_ids"][0],
|
||||||
|
}
|
||||||
)
|
)
|
||||||
if len(result["statement_ids"]) == 1:
|
|
||||||
action.update(
|
|
||||||
{
|
|
||||||
"view_mode": "form,tree",
|
|
||||||
"views": False,
|
|
||||||
"res_id": result["statement_ids"][0],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
action["domain"] = [("id", "in", result["statement_ids"])]
|
|
||||||
else:
|
else:
|
||||||
# dispatch to reconciliation interface
|
action["domain"] = [("id", "in", result["statement_ids"])]
|
||||||
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
|
return action
|
||||||
|
|
||||||
def _prepare_create_attachment(self, result):
|
def _prepare_create_attachment(self, result):
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<button
|
<button
|
||||||
name="import_file_button"
|
name="import_file_button"
|
||||||
string="Import"
|
string="Import and View"
|
||||||
type="object"
|
type="object"
|
||||||
class="btn-primary"
|
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" />
|
<button string="Cancel" class="btn-default" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -21,16 +21,6 @@
|
|||||||
<field name="sequence" position="attributes">
|
<field name="sequence" position="attributes">
|
||||||
<attribute name="invisible">1</attribute>
|
<attribute name="invisible">1</attribute>
|
||||||
</field>
|
</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">
|
<field name="narration" position="attributes">
|
||||||
<attribute name="invisible">1</attribute>
|
<attribute name="invisible">1</attribute>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user