Skip to Content
Our blog

How to Generate Inventory Stock Report Using Custom Commands in Odoo 18 Command Palette?

AN · July 23, 2026

Modern ERP systems are all about speed, efficiency, and reducing unnecessary clicks. With Odoo 18, one prevailing yet often underutilised feature is the Command Palette, a smart interface that allows users to instantly access actions, menus, and even custom developer tools.

In this blog, we’ll walk through how to create a custom command that generates an inventory stock report, directly from the Command Palette, without navigating through multiple menus.

What is the Command Palette?

Odoo 18 provides a useful feature called the Command Palette. You can open it using the keyboard shortcut:

  • Ctrl + K

This palette allows users to quickly search menus, users, channels, and other items. Developers can also extend this feature by adding custom commands that execute backend logic. In this example, we create a command that opens a filtered inventory report.

Step 1: Create the Module Manifest

Create the module manifest file __manifest__.py.

				
					{
   'name': 'Inventory Stock Report using Command Palette',
   'version': '1.0',
   'summary': 'Add custom command palette actions',
   'category': 'Tools',
   'depends': ['web','product'],
   'data': [],
   'assets': {
   	'web.assets_backend': [
       	'smart_commands/static/src/js/command_provider.js',
   	],
   },
   'installable': True,
}

				
			

Step 2: Backend Python Method

First, extend the product.product model and create a method that returns an Odoo action. product.py

				
					from odoo import models, api, _
class ProductProduct(models.Model):
   _inherit = 'product.product'
   @api.model
   def generate_report(self):
   	return {
       	'name': _('Monthly Inventory Report'),
       	'type': 'ir.actions.act_window',
       	'res_model': 'product.product',
       	'view_mode': 'list,form',
       	'views': [[False, 'list'], [False, 'form']],
       	'domain': [('qty_available', '>=', 0)],
       	'target': 'current',
   	}

				
			

This method returns an action that opens the product list view filtered by available quantity.

Step 3: Add JavaScript Command

Next, create a JavaScript file to register the command in the Command Palette.

Your_module/static/src/js/command_provider.js

				
					/** @odoo-module **/
 import { registry } from "@web/core/registry";
import { _t } from "@web/core/l10n/translation";
const commandSetupRegistry = registry.category("command_setup");
const commandProviderRegistry = registry.category("command_provider");
// 1. Setup the visual header
commandSetupRegistry.add("smart_dev_actions", {
   name: _t("Developer Smart Actions"),
});
// 2. Define the search logic
commandProviderRegistry.add("smart_report_provider", {
   async provide(env, options) {
   	return [{
       	name: _t("Generate Monthly Developer Report"),
       	searchValues: ["smart", "report", "health"],
       	category: "smart_dev_actions",
       	action: async () => {
           	try {
               	// Call the Python method using ORM service
               	const action = await env.services.orm.call(
                   	"product.product",
                   	"generate_report",
                   	[] // Ensure this empty array is closed correctly
               	);
               	// If Python returns the action dictionary, execute it
               	if (action && action.type) {
                       env.services.action.doAction(action);
               	}
                   env.services.notification.add(_t("Report Generated Successfully!"), {
                   	type: "success",
               	});
           	} catch (error) {
               	console.error("Smart Command Error:", error);
           	}
       	},
   	}];
   },
});

				
			

This code registers a custom command inside the Command Palette.

Step 4: Using the Command

  1. Open Odoo.
  2. Press: Ctrl + K
how-to-generate-inventory-stock-report-using-custom-commands-in-odoo-18-command-palette

Step 5: Search the Command

Type: Report

Select: Generate Monthly Developer Report.

how-to-generate-inventory-stock-report-using-custom-commands-in-odoo-18-command-palette

Step 6: Execute the Command

Click on the Generate Monthly Developer Report. Odoo will open a product report where the Quantity Available ≥ 0.

how-to-generate-inventory-stock-report-using-custom-commands-in-odoo-18-command-palette

 When the command is executed:

  •     The product list view opens.
  •     Only products with available quantities greater than or equal to 0 are displayed.
  •     A success notification appears on the screen.

This approach allows developers to create quick tools that execute backend actions directly from the Command Palette.

Boost Productivity with Smart Commands

Custom commands in the Odoo 18 Command Palette provide a fast and efficient way to execute actions directly from the interface. By combining a simple backend method with a JavaScript command, developers can quickly trigger reports or other operations. This approach improves productivity by reducing the need to navigate through multiple menus.

Start implementing your own custom commands today and turn Odoo into a faster, more efficient system personalised to your business needs.