Skip to Content
Menu
This question has been flagged
1 Reply
1817 Views

Hello Community,

How do I import these imports from Odoo 15 to Odoo 17?

Part one:

var ListController = require('web.ListController');
var ListView = require('web.ListView');
var viewRegistry = require('web.view_registry');
var core = require('web.core');
var session = require('web.session');
var Dialog = require('web.Dialog');
var QWeb = core.qweb;
var rpc = require('web.rpc');
var ajax = require('web.ajax');


Part 2: var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var rpc = require('web.rpc');
var QWeb = core.qweb;
var Dialog = require('web.Dialog');
var ajax = require('web.ajax');
Avatar
Discard
Best Answer

Hi,


/** @odoo-module */


// As the first line in the file, you need to use class-based components.


Here's how you can update these imports:


import { ListController } from '@web/views/list/list_controller';

import { listView } from '@web/views/list/list_view';

import { registry } from '@web/core/registry';

import { session } from '@web/session';

import { Dialog } from '@web/core/dialog/dialog';


// The web.core module in earlier versions of Odoo contained various utilities. In Odoo 17, you'll need to import specific utilities from their new locations:

import { _t } from '@web/core/l10n/translation';

import { browser } from '@web/core/browser/browser';

import { useService } from '@web/core/utils/hooks';


// In the setup, you can define

this.rpc = useService('rpc');


// In earlier versions, we used web.ajax for ajax implementation, but in Odoo 17, we are using jsonrpc instead of ajax.jsonRpc. For example:

import { jsonrpc } from '@web/core/network/rpc_service';


// In Odoo 17, AbstractAction is typically replaced by creating a custom component using the Owl framework:

import { Component } from '@odoo/owl';

export class MyCustomAction extends Component {

    // static template = 'my_custom_template';

    // Your custom code here

    setup() {

        // Initialization logic for your action

        console.log('My custom action started!');

    }

};


// Register your custom action

registry.category('actions').add('my_custom_action', MyCustomAction);


// Rather than using QWeb.render(), you'll create Owl components that define both the template and the related logic:

class MyComponent extends Component {

    static template = xml`

        <div>

            <p>Hello</p>

        </div>

    `;

}


Hope it helps

Avatar
Discard
Author

I am actually trying to migrate your module from 15 to 17: https://apps.odoo.com/apps/modules/15.0/stock_3d_view.
Any pointers on this @Cybrosys Techno Solutions Pvt.Ltd?

Related Posts Replies Views Activity
1
Jun 25
767
2
May 25
1079
1
May 25
493
1
Feb 25
38
1
Feb 25
1013