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