Is there a way to automatically navigate to the accounting dashboard once the extract import is complete?

In the Odoo accounting module, you have the option to import bank statements. After the import is completed, it automatically takes you to the reconciliation view, but I am looking to redirect it to the accounting dashboard.

Upon further inspection, I discovered that the JavaScript code responsible for the redirection can be found here:

enterprise-13.0/account_bank_statement_import_csv/static/src/js/import_bank_stmt.js:58

exit: function () {
    this.do_action({
        name: _t("Reconciliation on Bank Statements"),
        context: {
            'statement_line_ids': this.statement_line_ids
        },
        type: 'ir.actions.client',
        tag: 'bank_statement_reconciliation_view'
    });
},

I have attempted to modify the code in order to redirect to the accounting dashboard without success.

    exit: function () {
        var self = this;
        console.log("JavaScript redirection after importing");

        // var model_obj = new instance.web.Model('ir.model.data');
        // var view_id = false;
        // model_obj.call('get_object_reference', ['ir.ui.view', 'account.account_journal_dashboard_kanban_view']).then(function (result) {
        //     view_id = result[1];
        // });
        // console.log('view_id');
        // console.log(view_id);

        // this._rpc({
        //     model: 'account.move',
        //     method: 'redirect_return', // Python code that returns the data of the view action.
        // }).then(function (result) {
        //     self.do_action(result);
        // });

        this.do_action({
            name: _t("Reconciliation on Bank Statements"),
            context: {
                'statement_line_ids': this.statement_line_ids
            },
            type: 'ir.actions.client',
            tag: 'bank_statement_reconciliation_view'
        });
    },

I would appreciate your assistance with this matter.

Answer â„–1

Utilize this._rpc to retrieve the view ID and then invoke do_action for redirection.

self._rpc({
    model: "ir.model.data",
    method: 'get_object_reference',
    args: ['account', 'view_account_invoice_report_graph']
}).then(function (result) {
    self.do_action({
        name: _t('Invoices Analysis'),
        type: 'ir.actions.act_window',
        res_model: 'account.invoice.report',
        views: [[result[1], 'graph']],
        view_mode: 'graph',
    });
});  

Another approach is using the action external ID to access action data.

self._rpc({
    model: "ir.model.data",
    method: 'get_object_reference',
    args: ['account', 'action_account_invoice_report_all']
}).then(function (result) {
    self._rpc({
        model: "ir.actions.act_window",
        method: 'read',
        args: [[result[1]]]
    }).then(function (actions){
        self.do_action(actions[0]);
    });
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I implement a jQuery popup that prompts users to log in or register if they are not currently authenticated?

My JavaScript code includes jQuery and AJAX functionality for a specific action. Whenever a user id is not provided, and there isn't one stored in the session, I aim to prompt the user with a dialog box asking them to either register or log in. Could ...

"Troubleshooting: Angular 1.x component not displaying templateUrl content in the DOM

This is how I have set up my component: // app/my-component/my-component.js app.component('myComponent', { bindings: { bindingA: '=', bindingB: '=' }, templateUrl: 'app/my-component/my-compone ...

Connecting to a fresh dynamic route does not impact the getInitialProps data

I am struggling to understand the difference between componentDidMount and getInitialProps. Despite my best efforts to research, I still can't figure out when to use each one in my specific case. Let me give you some context. I have a page called /co ...

What is the process for reporting a security vulnerability in an npm package if you are the maintainer and publisher?

If I discover a security flaw in my published packages, how can I indicate which versions are vulnerable so that users running `npm audit` will be alerted? ...

A guide on showcasing real-time data with Angular's service feature

home.component.ts <h1>{{ (reportsToday$ | async)}}</h1> <div echarts [options]="alertsDaily$ | async"> <div echarts [options]="alertsToday$ | async"> <div [onDisplay]="alertsDaily$ | async"> report.component.ts constructor( ...

Substitutions not functional when using SendGrid in conjunction with Firebase functions

I'm encountering difficulties when trying to include substitutions data in emails sent from Sendgrid using Firebase Cloud Functions. Here's my function exports.firestoreEmail = functions.firestore .document('users/{id}') .onCreate(s ...

Browsing through a JSON document

Currently, I am attempting to extract schedule information from a JSON file called js/schedule.json. The format of this file is as follows: [ {"date":"12/06/2014","day":"Thursday","kick-off":"21:00","team1":"Brazil","team2":"Croatia","group":"A","stage":" ...

"Execute asynchronous tasks in Javascript and receive the returned

Currently, I am utilizing JSF ajax within my application and unfortunately, we are unable to make any changes to that. In the process of waiting for user action, I find it necessary to prompt the user before executing the ajax method. Specifically, I need ...

Tips for optimizing the placement of div elements for top advertisements on Amazon's website

I'm looking to overlay some divs on top of Amazon.com ads, similar to the image above. This is part of a personal project where I need to position these divs precisely over the ads. To achieve this effect, I've been using getBoundingClientRect t ...

Adjust input width based on content in VueJS

Is it possible to achieve the following using (Pug & CoffeeScript): input(placeholder="0", v-model.number="order[index]" v-on:change="adjustInput") ... adjustInput: -> event.target.style.width = event.target.value.length + 'ch' Even ...

Adding a JSON array to HTML using JavaScript

Looking to incorporate JSON Array data into an HTML list with Headings/Subheadings using JavaScript. I experimented with two methods - one involving jQuery and the other mostly vanilla JS. The initial attempt (link here: http://jsfiddle.net/myu3jwcn/6/) b ...

Easily resolving conflicts by removing `package-lock.json`

Whenever I work in a team environment, I often encounter merge conflicts with the package-lock.json file. My usual solution is to simply delete the file and generate it again using npm install. So far, I haven't noticed any negative effects from this ...

Dynamic Binding of Checkboxes in Vuex

I am encountering a problem with binding checkboxes using Vuex. Even though I am using v-model with a variable that has a getter and setter to set or get the value in the store, I keep getting incorrect data in the store. The issue arises when I click on a ...

The latest error in the Next.js 13 app directory: React child is not valid (detected: [object Promise])

I am currently utilizing the new app directory feature in Next.js 13. Within my project, I have a page component located at app/page.tsx. This component contains the following code snippet: "use client"; import { useState } from "react" ...

The icons from FontAwesome in Vue do not update when computed

I am seeking a way to dynamically change the header icon based on a conversation property. <a class="navbar-item" :title="$t('header.lock')" @click="makePrivate"> <i class="fas" :class="getLockClass"></i> </a> These ...

The duration for which an API Access Token remains valid is extremely brief

I recently started working with APIs and my current project involves using the Petfinder API v2 to develop a website that allows users to search for adoptable animals. The API utilizes OAuth, requiring a key and secret to obtain a token via CURL. However, ...

Discovering common time intervals without the date component in between

I need to identify the intersection between two time ranges, focusing solely on the time and not the date. For instance, range_1 is from 9AM to 6PM while range_2 spans from 5PM to 8AM. The times are in the 24-hour format. I have a solution that finds the o ...

remove a section from the main body

body { display: flex; justify-content: center; align-items: center; background: #0e1538; } <canvas id="spaceholder" width="804" height="604"></canvas> </div> <div class="MenĂ¼Center"> <canvas id="canvas" width="800" ...

EaselJS: Enhancing Performance and Aesthetics with Over 200 Vector Shapes

When comparing EaselJS performance with Canvas native methods, I noticed a significant difference: 2.2 s vs 0.01 s (despite EaselJS mapping canvas native methods). I created a canvas application that draws a tree*. For animating the growth of the tree, us ...

Warning: Using synchronous XMLHttpRequest on the main thread is no longer recommended as it can negatively impact the user's experience

I encountered an issue with my project while attempting an Ajax request [Warning] Using synchronous XMLHttpRequest on the main thread is now considered deprecated due to its negative impact on user experience. function retrieveReviews() { var reviewsD ...