[IMP] account_statement_import: add consistency

If you are importing from a journal, data should be consistent
This commit is contained in:
Enric Tobella
2022-11-17 16:54:14 +01:00
committed by sonhd91
parent c0cd9104e9
commit 936c8e800d
2 changed files with 9 additions and 1 deletions

View File

@@ -230,6 +230,15 @@ class AccountStatementImport(models.TransientModel):
],
limit=1,
)
journal_id = self.env.context.get("journal_id")
if journal_id and journal.id != journal_id:
raise UserError(
_(
"The journal found for the file is not consistent with the "
"selected journal. You should use the proper journal or "
"use the generic button on the top of the Accounting Dashboard"
)
)
if not journal:
bank_accounts = self.env["res.partner.bank"].search(

View File

@@ -39,7 +39,6 @@
<field name="target">new</field>
</record>
<record id="account_statement_import_menu" model="ir.ui.menu">
<field name="name">Import Statement</field>
<field name="parent_id" ref="account.menu_finance_entries_actions" />