mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
@@ -22,4 +22,12 @@
|
||||
"demo/partner_bank.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"account_statement_import/static/src/js/account_dashboard_kanban.js",
|
||||
],
|
||||
"web.assets_qweb": [
|
||||
"account_statement_import/static/src/xml/account_dashboard_kanban.xml"
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
odoo.define("account_statement_import.dashboard.kanban", function (require) {
|
||||
"use strict";
|
||||
|
||||
var viewRegistry = require("web.view_registry");
|
||||
var KanbanView = require("web.KanbanView");
|
||||
|
||||
var AccountDashboardView = viewRegistry.get("account_dashboard_kanban");
|
||||
// Value can be undefined on some test scenarios. Avoid an error by checking if it is defined
|
||||
if (AccountDashboardView !== undefined) {
|
||||
var AccountDashboardController =
|
||||
AccountDashboardView.prototype.config.Controller;
|
||||
AccountDashboardController.include({
|
||||
buttons_template: "AccountDashboardView.buttons",
|
||||
// We are reusing the create button
|
||||
_onButtonNew: function (ev) {
|
||||
ev.stopPropagation();
|
||||
return this.trigger_up("do_action", {
|
||||
action: "account_statement_import.account_statement_import_action",
|
||||
});
|
||||
},
|
||||
});
|
||||
AccountDashboardView = KanbanView.extend({
|
||||
config: _.extend({}, KanbanView.prototype.config, {
|
||||
Controller: AccountDashboardController,
|
||||
}),
|
||||
});
|
||||
return {
|
||||
AccountDashboardView: AccountDashboardView,
|
||||
AccountDashboardController: AccountDashboardController,
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<template>
|
||||
<t t-name="AccountDashboardView.buttons">
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
t-attf-class="btn #{btnClass} o-kanban-button-new"
|
||||
accesskey="c"
|
||||
>
|
||||
<t t-esc="_t('Import Statement (OCA)')" />
|
||||
</button>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
@@ -11,6 +11,13 @@
|
||||
<field name="model">account.journal</field>
|
||||
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view" />
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
We need to add the create tag in order to show buttons.
|
||||
However, we will change them using the JS definition.
|
||||
-->
|
||||
<kanban position="attributes">
|
||||
<attribute name="create">1</attribute>
|
||||
</kanban>
|
||||
<xpath expr='//span[@name="button_import_placeholder"]' position='inside'>
|
||||
<span>or <a
|
||||
type="object"
|
||||
|
||||
@@ -222,6 +222,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(
|
||||
|
||||
@@ -39,4 +39,11 @@
|
||||
<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" />
|
||||
<field name="action" ref="account_statement_import_action" />
|
||||
<field name="sequence" eval="70" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user