Skip to content

Commit b16e643

Browse files
ged-odoofdardenne
authored andcommitted
[ADD] Discover the JavaScript framework
1 parent 6326255 commit b16e643

File tree

29 files changed

+355
-6
lines changed

29 files changed

+355
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Odoo tutorials
22

33
This repository hosts the code for the bases and solutions of the
4-
[official Odoo tutorials](https://www.odoo.com/documentation/16.0/developer/howtos.html).
4+
[official Odoo tutorials](https://www.odoo.com/documentation/17.0/developer/tutorials.html).
55

6-
It has 2 branches for each Odoo version: one for the bases and one for
7-
the solutions. For example, `16.0` and `16.0-solutions`. The first
8-
contains the code of the modules that serve as base for the tutorials,
9-
and the second contains the code of the same modules with the complete
10-
solution.
6+
It has 3 branches for each Odoo version: one for the bases, one for
7+
[Discover the JS framework](https://www.odoo.com/documentation/17.0/developer/tutorials/discover_js_framework.html) solutions and one for [Master the Odoo web framework](https://www.odoo.com/documentation/17.0/developer/tutorials/master_odoo_web_framework.html) solutions. For example, `17.0`, `17.0-discover-js-framework-solutions` and `17.0-master-odoo-web-framework-solutions`.
8+
The first contains the code of the modules that serve as base for the tutorials,
9+
and the others contains the code of each chapter with the complete
10+
solution.

awesome_clicker/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

awesome_clicker/__manifest__.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
{
3+
'name': "Awesome Clicker",
4+
5+
'summary': """
6+
Starting module for "Master the Odoo web framework, chapter 1: Build a Clicker game"
7+
""",
8+
9+
'description': """
10+
Starting module for "Master the Odoo web framework, chapter 1: Build a Clicker game"
11+
""",
12+
13+
'author': "Odoo",
14+
'website': "https://www.odoo.com/",
15+
'category': 'Tutorials/AwesomeClicker',
16+
'version': '0.1',
17+
'application': True,
18+
'installable': True,
19+
'depends': ['base', 'web'],
20+
21+
'data': [],
22+
'assets': {
23+
'web.assets_backend': [
24+
'awesome_clicker/static/src/**/*',
25+
],
26+
27+
},
28+
'license': 'AGPL-3'
29+
}

awesome_dashboard/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from . import controllers

awesome_dashboard/__manifest__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
{
3+
'name': "Awesome Dashboard",
4+
5+
'summary': """
6+
Starting module for "Discover the JS framework, chapter 2: Build a dashboard"
7+
""",
8+
9+
'description': """
10+
Starting module for "Discover the JS framework, chapter 2: Build a dashboard"
11+
""",
12+
13+
'author': "Odoo",
14+
'website': "https://www.odoo.com/",
15+
'category': 'Tutorials/AwesomeDashboard',
16+
'version': '0.1',
17+
'application': True,
18+
'installable': True,
19+
'depends': ['base', 'web', 'mail', 'crm'],
20+
21+
'data': [
22+
'views/views.xml',
23+
],
24+
'assets': {
25+
'web.assets_backend': [
26+
'awesome_dashboard/static/src/**/*',
27+
],
28+
},
29+
'license': 'AGPL-3'
30+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from . import controllers
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import logging
4+
import random
5+
6+
from odoo import http
7+
from odoo.http import request
8+
9+
logger = logging.getLogger(__name__)
10+
11+
class AwesomeDashboard(http.Controller):
12+
@http.route('/awesome_dashboard/statistics', type='json', auth='user')
13+
def get_statistics(self):
14+
"""
15+
Returns a dict of statistics about the orders:
16+
'average_quantity': the average number of t-shirts by order
17+
'average_time': the average time (in hours) elapsed between the
18+
moment an order is created, and the moment is it sent
19+
'nb_cancelled_orders': the number of cancelled orders, this month
20+
'nb_new_orders': the number of new orders, this month
21+
'total_amount': the total amount of orders, this month
22+
"""
23+
24+
return {
25+
'average_quantity': random.randint(4, 12),
26+
'average_time': random.randint(4, 123),
27+
'nb_cancelled_orders': random.randint(0, 50),
28+
'nb_new_orders': random.randint(10, 200),
29+
'orders_by_size': {
30+
'm': random.randint(0, 150),
31+
's': random.randint(0, 150),
32+
'xl': random.randint(0, 150),
33+
},
34+
'total_amount': random.randint(100, 1000)
35+
}
36+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @odoo-module **/
2+
3+
import { Component } from "@odoo/owl";
4+
import { registry } from "@web/core/registry";
5+
6+
class AwesomeDashboard extends Component {
7+
static template = "awesome_dashboard.AwesomeDashboard";
8+
}
9+
10+
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
4+
<t t-name="awesome_dashboard.AwesomeDashboard">
5+
hello dashboard
6+
</t>
7+
8+
</templates>

awesome_dashboard/views/views.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<odoo>
2+
<data>
3+
<record model="ir.actions.client" id="dashboard">
4+
<field name="name">Dashboard</field>
5+
<field name="tag">awesome_dashboard.dashboard</field>
6+
</record>
7+
8+
<menuitem name="Awesome Dashboard" id="awesome_dashboard.menu_root" groups="base.group_user" web_icon="awesome_dashboard,static/description/icon.png"/>
9+
<menuitem name="Dashboard" id="awesome_dashboard.dashboard_menu" parent="awesome_dashboard.menu_root" action="awesome_dashboard.dashboard" sequence="1"/>
10+
</data>
11+
</odoo>

0 commit comments

Comments
 (0)