How to Configure Client Action in Odoo 17
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilitate
- Inventar
- PoS
- Proiect
- MRP
Această întrebare a fost marcată
Hi,
1. Create a XML file (client_action_views.xml)
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Action to show the Dashboard-->
<record id="advanced_dashboard_action" model="ir.actions.client">
<field name="name">Advanced Dashboard</field>
<field name="tag">advanced_dashboard<
</record>
<!-- Menu Item to show the dashboard menu in the module-->
<menuitem name="Dashboards" id="advanced_dashboard_menu"
sequence="1" action="advanced_dashboard_
</odoo>
2. Create a JS file(client_action.js)
/** @odoo-module */
import { registry} from '@web/core/registry';
import { useService } from "@web/core/utils/hooks";
const { Component, mount} = owl
export class AdvancedDashboard extends Component {
setup(){
this.action = useService("action");
this.rpc = this.env.services.rpc
}
loadData(){
let self = this;
rpc.query({
model: 'partner.dashboard',
method: 'get_values',
args:[]
}).then(function(data){
console.log(data, 'dataaaa')
self.AdvancedDashboard.data = data;
});
}
}
AdvancedDashboard.template = "client_action.advanced_dashboard"
registry.category("actions").add("advanced_dashboard", AdvancedDashboard)
3. Create a Python file (partner_dashboard.py)
from odoo import api, fields, models
class EmployeeDashboard(models.Model):
_name = 'partner.dashboard'
_description = 'Partner Dashboard'
user_id = fields.Many2one('res.users', string='Users')
name = fields.Char(string='Partner Name')
@api.model
def get_values(self):
data = self.env['partner.dashboard'].search([])
# we can add the values to the dashboard
return data.read()
4. create a Xml file in static/src/xml(client_action.xml)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Template for the Advanced Dashboard -->
<templates id="template" xml:space="preserve">
<t t-name="client_action.
<div>
<span>Test Case</span>
<h1><center><span>Partner Details</span></center></h1>
</div>
<!-- You can add the templates here-->
</t>
</templates>
5. Add manifest like format
'data': [
'views/client_action_views.xml'
],
'assets': {
'web.assets_backend': [
'client_action/static/src/js/client_action.js',
'client_action/static/src/xml/client_action.xml',
],
},
Please refer to this blog:
Client Action in Odoo17
Hope it helps
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-te