Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] estate : adding new module in tutorials #216

Open
wants to merge 22 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c097d69
[ADD] Create new module for Chapter 1
AbdelrahmanFawzy1 Dec 16, 2024
95b57eb
[IMP] estate: add ORM table fields
AbdelrahmanFawzy1 Dec 17, 2024
1c040ea
[IMP] estate: security permissions added
AbdelrahmanFawzy1 Dec 17, 2024
cc2e471
[IMP] estate: views added
AbdelrahmanFawzy1 Dec 17, 2024
2c0d253
[IMP] estate: More views Added
AbdelrahmanFawzy1 Dec 18, 2024
4792d6a
[IMP] estate: Models Relationships
AbdelrahmanFawzy1 Dec 18, 2024
fc1c6e2
[IMP] Add computed fields
AbdelrahmanFawzy1 Dec 19, 2024
09a8058
[IMP] Actions Added
AbdelrahmanFawzy1 Dec 19, 2024
5f8c979
[IMP] Constraints Added
AbdelrahmanFawzy1 Dec 19, 2024
927b96d
[IMP] fix
AbdelrahmanFawzy1 Dec 19, 2024
32dd96b
[IMP] add license field
AbdelrahmanFawzy1 Dec 20, 2024
9eef81a
[CLN] Clean up estate_property.py formatting
AbdelrahmanFawzy1 Dec 20, 2024
46e1e6e
[FIX] Update estate_property.py for issue resolution
AbdelrahmanFawzy1 Dec 20, 2024
b289ebc
[IMP] Update estate_property_offer.py for improvements
AbdelrahmanFawzy1 Dec 20, 2024
e4e3326
[IMP] style files using black
AbdelrahmanFawzy1 Dec 20, 2024
7d44f47
[IMP] Added Sprinkles
AbdelrahmanFawzy1 Dec 23, 2024
4e1d2a7
[IMP] Inheritance added
AbdelrahmanFawzy1 Dec 23, 2024
77004d5
[IMP] Invoicing Linked
AbdelrahmanFawzy1 Dec 23, 2024
2da5257
[IMP] Kanban View added
AbdelrahmanFawzy1 Dec 23, 2024
ac82719
[IMP] Issues Fix
AbdelrahmanFawzy1 Dec 24, 2024
0445d11
[IMP] Chapter 1: Web Framework
AbdelrahmanFawzy1 Dec 26, 2024
44a16fb
[IMP] Chapter 2 first parts
AbdelrahmanFawzy1 Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions awesome_clicker/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# -*- coding: utf-8 -*-
{
'name': "Awesome Clicker",

'summary': """
"name": "Awesome Clicker",
"summary": """
Starting module for "Master the Odoo web framework, chapter 1: Build a Clicker game"
""",

'description': """
"description": """
Starting module for "Master the Odoo web framework, chapter 1: Build a Clicker game"
""",

'author': "Odoo",
'website': "https://www.odoo.com/",
'category': 'Tutorials/AwesomeClicker',
'version': '0.1',
'application': True,
'installable': True,
'depends': ['base', 'web'],

'data': [],
'assets': {
'web.assets_backend': [
'awesome_clicker/static/src/**/*',
"author": "Odoo",
"website": "https://www.odoo.com/",
"category": "Tutorials/AwesomeClicker",
"version": "0.1",
"application": True,
"installable": True,
"depends": ["base", "web"],
"data": [],
"assets": {
"web.assets_backend": [
"awesome_clicker/static/src/**/*",
],

},
'license': 'AGPL-3'
"license": "AGPL-3",
}
37 changes: 17 additions & 20 deletions awesome_dashboard/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# -*- coding: utf-8 -*-
{
'name': "Awesome Dashboard",

'summary': """
"name": "Awesome Dashboard",
"summary": """
Starting module for "Discover the JS framework, chapter 2: Build a dashboard"
""",

'description': """
"description": """
Starting module for "Discover the JS framework, chapter 2: Build a dashboard"
""",

'author': "Odoo",
'website': "https://www.odoo.com/",
'category': 'Tutorials/AwesomeDashboard',
'version': '0.1',
'application': True,
'installable': True,
'depends': ['base', 'web', 'mail', 'crm'],

'data': [
'views/views.xml',
"author": "Odoo",
"website": "https://www.odoo.com/",
"category": "Tutorials/AwesomeDashboard",
"version": "0.1",
"application": True,
"installable": True,
"depends": ["base", "web", "mail", "crm"],
"data": [
"views/views.xml",
],
'assets': {
'web.assets_backend': [
'awesome_dashboard/static/src/**/*',
"assets": {
"web.assets_backend": [
"awesome_dashboard/static/src/**/*",
"awesome_dashboard/static/src/scss/dashboard.scss",
],
},
'license': 'AGPL-3'
"license": "AGPL-3",
}
2 changes: 1 addition & 1 deletion awesome_dashboard/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

from . import controllers
from . import controllers
22 changes: 11 additions & 11 deletions awesome_dashboard/controllers/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

logger = logging.getLogger(__name__)


class AwesomeDashboard(http.Controller):
@http.route('/awesome_dashboard/statistics', type='json', auth='user')
@http.route("/awesome_dashboard/statistics", type="json", auth="user")
def get_statistics(self):
"""
Returns a dict of statistics about the orders:
Expand All @@ -22,15 +23,14 @@ def get_statistics(self):
"""

return {
'average_quantity': random.randint(4, 12),
'average_time': random.randint(4, 123),
'nb_cancelled_orders': random.randint(0, 50),
'nb_new_orders': random.randint(10, 200),
'orders_by_size': {
'm': random.randint(0, 150),
's': random.randint(0, 150),
'xl': random.randint(0, 150),
"average_quantity": random.randint(4, 12),
"average_time": random.randint(4, 123),
"nb_cancelled_orders": random.randint(0, 50),
"nb_new_orders": random.randint(10, 200),
"orders_by_size": {
"m": random.randint(0, 150),
"s": random.randint(0, 150),
"xl": random.randint(0, 150),
},
'total_amount': random.randint(100, 1000)
"total_amount": random.randint(100, 1000),
}

10 changes: 0 additions & 10 deletions awesome_dashboard/static/src/dashboard.js

This file was deleted.

8 changes: 0 additions & 8 deletions awesome_dashboard/static/src/dashboard.xml

This file was deleted.

26 changes: 26 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useService } from "@web/core/utils/hooks";
import { Layout } from "@web/search/layout";
import { DashboardItem } from "../dashboard_items/dashboard_items";

export class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
static components = { Layout, DashboardItem };


setup() {
this.action = useService("action");
}

openCustomers() {
this.action.doAction("base.res_partner_action_kanban");
}

openLeads() {
this.action.doAction({
name: "Leads",
type: "ir.actions.act_window",
res_model: "crm.lead",
views: [[false, "list"], [false, "form"]],
});
}
}
3 changes: 3 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.o_dashboard {
background-color: gray;
}
19 changes: 19 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_dashboard.AwesomeDashboard">
<Layout display="{controlPanel: {} }" className="'o_dashboard h-100'">
<t t-set-slot="layout-buttons">
<div class="o_cp_buttons" role="toolbar" aria-label="Control Panel Buttons" t-ref="buttons">
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
<button class="btn btn-primary" style="margin-left: 0.5em" t-on-click="openLeads">Leads</button>
</div>
</t>
<t t-slot="content">
<DashboardItem>Item 1</DashboardItem>
<DashboardItem size="2">Item 2</DashboardItem>
</t>
</Layout>
</t>
</templates>

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_dashboard.DashboardItem">
<div class="o_dashboard_item" t-att-style="'width: ' + (props.size * 18) + 'rem'">
<t t-slot="default" />
</div>
</t>
</templates>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.o_dashboard_item {
background-color: #f4f4f4;
border: 1px solid #ddd;
padding: 1rem;
margin: 0.5rem;
border-radius: 0.5rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Component } from "@odoo/owl";

export class DashboardItem extends Component {
static template = "awesome_dashboard.DashboardItem";
static props = { size: { type: Number, optional: true, default: 1 } };
}
30 changes: 14 additions & 16 deletions awesome_gallery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
# -*- coding: utf-8 -*-
{
'name': "Gallery View",
'summary': """
"name": "Gallery View",
"summary": """
Starting module for "Master the Odoo web framework, chapter 3: Create a Gallery View"
""",

'description': """
"description": """
Starting module for "Master the Odoo web framework, chapter 3: Create a Gallery View"
""",

'version': '0.1',
'application': True,
'category': 'Tutorials/AwesomeGallery',
'installable': True,
'depends': ['web', 'contacts'],
'data': [
'views/views.xml',
"version": "0.1",
"application": True,
"category": "Tutorials/AwesomeGallery",
"installable": True,
"depends": ["web", "contacts"],
"data": [
"views/views.xml",
],
'assets': {
'web.assets_backend': [
'awesome_gallery/static/src/**/*',
"assets": {
"web.assets_backend": [
"awesome_gallery/static/src/**/*",
],
},
'license': 'AGPL-3'
"license": "AGPL-3",
}
8 changes: 4 additions & 4 deletions awesome_gallery/models/ir_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


class ActWindowView(models.Model):
_inherit = 'ir.actions.act_window.view'
_inherit = "ir.actions.act_window.view"

view_mode = fields.Selection(selection_add=[
('gallery', "Awesome Gallery")
], ondelete={'gallery': 'cascade'})
view_mode = fields.Selection(
selection_add=[("gallery", "Awesome Gallery")], ondelete={"gallery": "cascade"}
)
4 changes: 2 additions & 2 deletions awesome_gallery/models/ir_ui_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@


class View(models.Model):
_inherit = 'ir.ui.view'
_inherit = "ir.ui.view"

type = fields.Selection(selection_add=[('gallery', "Awesome Gallery")])
type = fields.Selection(selection_add=[("gallery", "Awesome Gallery")])
30 changes: 14 additions & 16 deletions awesome_kanban/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
# -*- coding: utf-8 -*-
{
'name': "Awesome Kanban",
'summary': """
"name": "Awesome Kanban",
"summary": """
Starting module for "Master the Odoo web framework, chapter 4: Customize a kanban view"
""",

'description': """
"description": """
Starting module for "Master the Odoo web framework, chapter 4: Customize a kanban view.
""",

'version': '0.1',
'application': True,
'category': 'Tutorials/AwesomeKanban',
'installable': True,
'depends': ['web', 'crm'],
'data': [
'views/views.xml',
"version": "0.1",
"application": True,
"category": "Tutorials/AwesomeKanban",
"installable": True,
"depends": ["web", "crm"],
"data": [
"views/views.xml",
],
'assets': {
'web.assets_backend': [
'awesome_kanban/static/src/**/*',
"assets": {
"web.assets_backend": [
"awesome_kanban/static/src/**/*",
],
},
'license': 'AGPL-3'
"license": "AGPL-3",
}
2 changes: 1 addition & 1 deletion awesome_owl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

from . import controllers
from . import controllers
Loading