KEMBAR78
Client Actions In Odoo 17 - Odoo 17 Slides | PPTX
Client Actions In Odoo 17
Enterprise
Introduction
Enterprise
In Odoo, a client action refers to a set of actions or operations
that are executed on the client side of the application. Odoo is an
open-source ERP (Enterprise Resource Planning) and business
management software, and it uses a client-server architecture.
The client-side actions in Odoo are typically defined using
JavaScript and XML. OWL is primarily used for representing and
reasoning about knowledge in a machine-readable way.
However, the mention of web frameworks, services, core
components, and hooks suggests a broader context, possibly
related to web development.
Enterprise
● Basic XML menu items use matching widget actions to
make up for client activities.
● Here, we'll look at how to add a menu to the sales order
menu.
● Selecting the sales orders, displaying them, and putting
them to use.
Enterprise
● Add a menu to the views/views.xml file in the directory of
the view to continue.
<?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</field>
</record>
<!--Menu Item to show the dashboard menu in the module-->
<menuitem name="Dashboards" id="advanced_dashboard_menu"
sequence="1" action="advanced_dashboard_action"/>
</odoo>
Enterprise
● when we create a Dashboard action (name to be
determined) to the ir.actions.client model.
● When the menu was clicked, the advanced_dashboard tag
—which is utilized in the widget to load or call the action
stated in the widget—was also added.
● With the aid of this tag, the widget's suggested action (JS
file) will be loaded or called.
Enterprise
/** @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)
Enterprise
● We are extending the Component class to create the widget. I have
specified a template (Advanced Dashboard) that will be displayed
when this activity is carried out.
● The template (advanced_dashboard), which is subsequently added
to the main Template's table view class (Advanced Dashboard),
receives the data by using the load data method from the start
function to retrieve it from the Python code.
● It is now necessary to specify the Python function file and the
qweb template that the RPC will use. Thus, we going to begin by
generating a models/filename.py Python file.
Enterprise
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()
Enterprise
Some keywords used by the client actions:
● tag: it refers to a unique identifier or key assigned to a
specific action or event on the client side of a software
application.
● params (optional): In Python, a dictionary is a suitable data
structure for representing key-value pairs, making it
convenient for sending structured data.
Enterprise
● target (optional):
1. Open in the main content area (current): This implies that
the client action should be displayed within the main
content area of the application. It's the default behavior if
the display mode is not explicitly specified.
2. Open in full-screen mode (fullscreen): This suggests that
the client action should take up the entire screen when
executed.
3. Open in a dialog/popup (new): This indicates that the
client action should be displayed in a separate dialog or
popup window.
Enterprise
The template should be defined first (in static/src/xml)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Template for the Advanced Dashboard -->
<templates id="template" xml:space="preserve">
<t t-name="client_action.advanced_dashboard">
<div>
<span>Test Case</span>
<h1><center><span>Partner Details</span></center></h1>
</div>
<!-- You can add the templates here→
</t>
</templates>
Enterprise
And the last one, we can add those files in the __manifest__.py
like this 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'
],
},
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

Client Actions In Odoo 17 - Odoo 17 Slides

  • 1.
    Client Actions InOdoo 17 Enterprise
  • 2.
    Introduction Enterprise In Odoo, aclient action refers to a set of actions or operations that are executed on the client side of the application. Odoo is an open-source ERP (Enterprise Resource Planning) and business management software, and it uses a client-server architecture. The client-side actions in Odoo are typically defined using JavaScript and XML. OWL is primarily used for representing and reasoning about knowledge in a machine-readable way. However, the mention of web frameworks, services, core components, and hooks suggests a broader context, possibly related to web development.
  • 3.
    Enterprise ● Basic XMLmenu items use matching widget actions to make up for client activities. ● Here, we'll look at how to add a menu to the sales order menu. ● Selecting the sales orders, displaying them, and putting them to use.
  • 4.
    Enterprise ● Add amenu to the views/views.xml file in the directory of the view to continue. <?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</field> </record> <!--Menu Item to show the dashboard menu in the module--> <menuitem name="Dashboards" id="advanced_dashboard_menu" sequence="1" action="advanced_dashboard_action"/> </odoo>
  • 5.
    Enterprise ● when wecreate a Dashboard action (name to be determined) to the ir.actions.client model. ● When the menu was clicked, the advanced_dashboard tag —which is utilized in the widget to load or call the action stated in the widget—was also added. ● With the aid of this tag, the widget's suggested action (JS file) will be loaded or called.
  • 6.
    Enterprise /** @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)
  • 7.
    Enterprise ● We areextending the Component class to create the widget. I have specified a template (Advanced Dashboard) that will be displayed when this activity is carried out. ● The template (advanced_dashboard), which is subsequently added to the main Template's table view class (Advanced Dashboard), receives the data by using the load data method from the start function to retrieve it from the Python code. ● It is now necessary to specify the Python function file and the qweb template that the RPC will use. Thus, we going to begin by generating a models/filename.py Python file.
  • 8.
    Enterprise from odoo importapi, 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()
  • 9.
    Enterprise Some keywords usedby the client actions: ● tag: it refers to a unique identifier or key assigned to a specific action or event on the client side of a software application. ● params (optional): In Python, a dictionary is a suitable data structure for representing key-value pairs, making it convenient for sending structured data.
  • 10.
    Enterprise ● target (optional): 1.Open in the main content area (current): This implies that the client action should be displayed within the main content area of the application. It's the default behavior if the display mode is not explicitly specified. 2. Open in full-screen mode (fullscreen): This suggests that the client action should take up the entire screen when executed. 3. Open in a dialog/popup (new): This indicates that the client action should be displayed in a separate dialog or popup window.
  • 11.
    Enterprise The template shouldbe defined first (in static/src/xml) <?xml version="1.0" encoding="UTF-8"?> <!-- Template for the Advanced Dashboard --> <templates id="template" xml:space="preserve"> <t t-name="client_action.advanced_dashboard"> <div> <span>Test Case</span> <h1><center><span>Partner Details</span></center></h1> </div> <!-- You can add the templates here→ </t> </templates>
  • 12.
    Enterprise And the lastone, we can add those files in the __manifest__.py like this 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' ], },
  • 13.
    For More Info. Checkour company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com