Skip to content

Commit 0e7619c

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

File tree

29 files changed

+348
-5
lines changed

29 files changed

+348
-5
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.languageServer": "None"
3+
}

README.md

Lines changed: 5 additions & 5 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/master/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
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/master/developer/tutorials/discover_js_framework.html) solutions and one for [Master the Odoo web framework](https://www.odoo.com/documentation/master/developer/tutorials/master_odoo_web_framework.html) solutions. For example, `master` and `master-discover-js-framework-solutions` and `master-master-odoo-web-framework-solutions`. The first
88
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.
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',
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',
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Component } from "@odoo/owl";
2+
import { registry } from "@web/core/registry";
3+
4+
class AwesomeDashboard extends Component {
5+
static template = "awesome_dashboard.AwesomeDashboard";
6+
}
7+
8+
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>

0 commit comments

Comments
 (0)