Build Interactive UI
Kanban View Odoo18 OWL tutorial, we will walk you through creating. OWL (Odoo Web Library) is a powerful JavaScript framework that helps build interactive UIs within Odoo. It integrates smoothly with Odoo’s backend and allows for custom views like Kanban, making your Odoo installation even more dynamic.

Introduction to Kanban Views
The Kanban View in Odoo is used to visually manage records in a board-style interface, with cards representing records that can be grouped into columns. This is ideal for workflows like sales opportunities, project management, or inventory tracking. By using OWL (Odoo Web Library), Odoo’s JavaScript framework, you can add rich interactivity and custom behavior to these Kanban views.
In this tutorial, we will focus on creating a Kanban View for customer locations using the res.partner model in Odoo 18. This will allow users to view and filter customer locations in a dynamic and interactive way. Kanban View Odoo18 OWL
Step 1: Set Up the Kanban View in XML
We will begin by defining the structure of the Kanban view using XML. This view will be based on the existing res.partner model and will inherit from Odoo’s base Kanban view.
Here’s the XML code to define the custom Kanban view:
<record id="view_partner_kanban_inherit" model="ir.ui.view">
<field name="name">res.partner.kanban.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="attributes">
<attribute name="js_class">res_partner_kanban_view</attribute>
</xpath>
</field>
</record>
Explanation:
inherit_id: This field ensures that our custom view inherits from the base Kanban view of theres.partnermodel.xpath: Thexpathexpression allows us to modify the existing Kanban view by adding a custom JavaScript class (js_class) to the<kanban>element. This is where OWL functionality is activated. Kanban View Odoo18 OWL
Step 2: Creating OWL Controller for Kanban
The next step is to implement the logic for the Kanban view using OWL. We will create a custom controller that will manage the customer locations and handle user interactions within the view.
Below is the JavaScript code to set up the OWL Controller for managing the Kanban view:
import { registry } from '@web/core/registry';
import { KanbanController } from '@web/views/kanban/kanban_controller';
import { useService } from '@web/core/utils/hooks';
class ResPartnerKanbanController extends KanbanController {
setup() {
super.setup();
this.action = useService("action");
this.orm = useService("orm");
}
async onWillStart() {
this.customerLocations = await this.orm.readGroup('res.partner', [], ['state_id']);
console.log(this.customerLocations);
}
openSalesView() {
console.log("Open Sales view");
this.action.doAction({
type: "ir.actions.act_window",
name: "Customer Sales",
res_model: "sale.order",
views: [[false, "list"], [false, "form"]],
});
}
setLocations(state) {
const id = state.id;
const name = state.name;
this.searchModel.setBottomInParts({
A1: [{ state_id: id }],
domain: [['state_id', '=', id]],
facetLabel: name,
});
}
}
ResPartnerKanbanController.template = "owl_inherit_views.ResPartnerKanbanView";
registry.category("views").add("res_partner_kanban_view", ResPartnerKanbanController);
Explanation:
ResPartnerKanbanController: This class controls the logic of the Kanban view. It interacts with the Odoo ORM to fetch customer location data and sets up user actions.onWillStart(): This method fetches the customer locations grouped by state (state_id) from theres.partnermodel.openSalesView(): This function opens the Sales Orders view when the corresponding button is clicked in the Kanban card.setLocations(): This function handles the logic for setting the customer locations based on the selected state, updating the view accordingly. Kanban View Odoo18 OWL
Step 3: Implementing Kanban Template with OWL
Once the controller is set up, we will define the Kanban template that will be used to render the customer locations in the UI. This template uses OWL’s syntax for rendering dynamic components.
Here is the template code:
<t t-name="owl_inherit_views.ResPartnerKanbanView" t-inherit="web.KanbanView" owl="1">
<xpath expr="//div[@class='o_kanban_view']" position="before">
<div class="p-3 bg-white o_res_partner_kanban_view_sidebar">
<h2>Customer Locations</h2>
<div class="list-group">
<t t-foreach="customerLocations" t-as="location" t-key="location.state_id[0]">
<a class="list-group-item" href="#" t-on-click="this.selectLocations(location.state_id)">
<span t-esc="location.state_id[1]" />
<span t-esc="location.state_id_count" />
</a>
</t>
</div>
</div>
</xpath>
</t>
Explanation:
t-foreach: This loop iterates over thecustomerLocationsarray, displaying each location’s state and the count of records for that state.t-on-click: When a location is clicked, theselectLocations()function is triggered, which updates the view to show only the records from that state.
Step 4: Testing and Finalizing the View
After you have created the XML view, JavaScript controller, and template, it’s time to test your Kanban view. Here’s how to do it:
- Deploy the Changes: After saving your changes, restart the Odoo server and refresh the Odoo interface.
- Navigate to Customer Locations: Go to the Customer Locations menu (or the parent model if you’ve added it there).
- Check Interactivity: Ensure that the customer locations are displayed correctly and that clicking on a location filters the data as expected. Kanban View Odoo18 OWL
Conclusion and Next Steps
In this tutorial, you learned how to create a custom Kanban View Odoo 18 OWL from scratch. By following these steps, you were able to:
- Set Up a Custom Kanban View: You used XML to define the structure of the Kanban view and how it interacts with the backend.
- Leverage OWL to Enhance Interactivity: OWL was utilized to add interactivity to the Kanban view, allowing users to filter and manage customer locations.
- Create and Implement a Custom JavaScript Controller: The OWL controller you created handles user interactions and data fetching, making the Kanban view dynamic and responsive.
The Kanban View Odoo 18 OWL is a powerful tool for displaying records and workflows in a more visual and manageable format. Whether you are managing customer locations, sales orders, or project statuses, the Kanban view can be customized to suit various business needs.
As you continue to work with Odoo, remember that this technique is not limited to just Kanban views. You can apply the same logic and structure to create custom views for any Odoo model. OWL allows you to integrate rich JavaScript functionality and make your views more interactive, giving users a seamless experience. Kanban View Odoo18 OWL
How Can You Expand on This?
Now that you’ve learned the basics of creating a Kanban view with OWL, there are several ways you can enhance this functionality:
- Add Additional Filters
You can add dropdowns or date pickers to further filter the records within the Kanban view. For example, filtering customers by specific regions or order status. - Integrate Other Odoo Models
You can integrate other models into your Kanban view. For instance, create a Kanban view that displays Sales Orders grouped by Order Status, and include interactive elements that trigger actions such as opening specific orders or invoices. - Improve the User Interface
Enhance the UI by adding more graphical elements, such as icons, charts, or progress bars. This can give users a quick overview of their business processes directly within the Kanban view. - Use Custom Actions
You can implement custom actions such as marking orders as completed, creating new opportunities, or sending emails directly from the Kanban view. - Integrate with External APIs
If your business needs to fetch or sync data from external sources (e.g., third-party CRM or payment systems), you can integrate APIs directly into your Kanban view. This allows you to combine the power of Odoo with other services your business relies on. - Performance Enhancements
As your Odoo instance grows, performance may become an issue. To address this, consider optimizing the database queries and using caching techniques. Make sure to always test the view for performance, especially when dealing with large datasets.
Common Mistakes to Avoid
While creating custom Kanban views in Odoo, there are some common pitfalls you should avoid:
- Overloading the View with Too Much Data
When displaying large datasets in a Kanban view, performance can degrade. Always test with realistic data sets to make sure the view loads quickly. Consider using server-side filtering to limit the amount of data sent to the frontend. - Not Using Proper Caching
Caching helps reduce database calls, speeding up the process of retrieving and displaying data. Make sure you use caching strategies for frequently accessed data, such as customer locations or sales orders. - Neglecting Mobile Responsiveness
Since more users access Odoo on mobile devices, make sure your Kanban view is responsive. Ensure that the layout adapts well to different screen sizes, using Odoo’s responsive features or custom CSS if necessary. - Overcomplicating the Template
Keep the template simple and focused on the most important elements. Too many elements or overly complex layouts can confuse users. Always aim for a clean and intuitive interface. - Skipping User Testing
Even after implementing the view, it’s important to conduct user testing. Get feedback from the end users to see if the view meets their needs and if it improves their workflow. Iterating based on this feedback will lead to a better product.
Why Should You Use OWL in Odoo?
OWL (Odoo Web Library) is an innovative JavaScript framework that significantly improves the way you build user interfaces in Odoo. By incorporating OWL, you can enhance the overall user experience, making it more dynamic, responsive, and easy to interact with.
Here are a few reasons why you should consider using OWL in your custom Odoo views:
- Enhanced Interactivity
OWL makes it easy to add interactive features to Odoo. With the reactive programming model, OWL allows you to dynamically update the UI based on user actions. This makes it ideal for building responsive, real-time views such as the Kanban View Odoo 18 OWL. - Reusability
OWL promotes the reuse of components, making it easier to maintain code. Instead of writing separate code for each view, you can use OWL’s component system to manage reusable components and logic. This results in cleaner, more organized code. - Performance
OWL is designed to be lightweight and efficient, which means it doesn’t affect the performance of your Odoo instance. With the OWL framework, you can build modern web UIs without worrying about slow rendering times. - Seamless Integration
OWL seamlessly integrates with Odoo’s architecture, which means you can take full advantage of Odoo’s ORM, models, and services. OWL components can easily fetch data from Odoo models, making it an excellent choice for dynamic and data-driven views like Kanban. - Modern JavaScript Framework
OWL brings modern JavaScript capabilities into Odoo, helping you develop more advanced features with ease. It uses React-like principles but is designed to be lightweight, making it a great choice for both Odoo developers and frontend developers.
Testing Your Kanban View
Once you’ve finished setting up the Kanban View Odoo 18 OWL, it’s time to test it.
Here are a few things to check during the testing phase:
- Data Loading
Ensure that the customer locations load quickly and that the data is being fetched correctly from the backend. Look for any performance issues and optimize accordingly. - Interactivity
Test the filtering functionality. Click on different locations and ensure the view updates accordingly. Check for bugs related to the actions, such as opening sales orders or invoices. - Mobile Responsiveness
Open the Kanban view on different devices (especially mobile) to ensure it looks good and works properly. Make any necessary adjustments for smaller screen sizes. - Error Handling
Test edge cases, such as when no data is available for a specific location or when the user does not have permission to access certain data. Make sure that the Kanban view handles these scenarios gracefully.
Conclusion and Next Steps
You have now completed the tutorial on Kanban View Odoo 18 OWL. You’ve learned how to:
- Create a custom Kanban View using XML and OWL in Odoo 18.
- Set up an OWL Controller to handle interactions and manage customer locations.
- Build a dynamic UI that reacts to user input and fetches data from Odoo models.
From here, you can expand your Odoo customization efforts. Consider implementing more interactive views, adding custom actions, or exploring other Odoo models to integrate into your Kanban view.
Next Steps:
- Experiment with other view types like List View or Form View.
- Explore adding more complex filters or data visualizations in your Kanban view.
- Share your work with the Odoo community and gather feedback for further improvements.
By mastering OWL and Kanban View Odoo 18 OWL, you can create highly interactive, user-friendly interfaces that enhance your business workflows.
Further Resources:
If you have any questions or would like to see more advanced use cases, feel free to explore the Odoo forums or check out additional Odoo tutorials!
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.

