-
Notifications
You must be signed in to change notification settings - Fork 2.9k
zavan - Technical Training #1131
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
Open
MAGREMENT
wants to merge
22
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:18.0-tutorials-zavan
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e08edd3
Chapter 1
5a61483
Chapter 3 & 4
5508240
[FIX] estate : Fixed bugs for chapter 3
b659879
[FIX] estate : Fixed bug for chapter 4
2edd4dd
[ADD] estate : Added chapter 5 features
b93b8d1
[ADD] estate : Added Chapter 6 features
11cb4e8
[ADD] estate : Chapter 7 features
1ddbf21
[FIX] estate : styling fixes
a243c06
[ADD] estate : Added chapter 8 features
f987789
[FIX] estate : Offer creation fix
fce113e
[ADD] estate : Added chapter 9 features
8038737
[ADD] estate : Added chapter 10 features
dd62755
[ADD] estate : Chapter 11 features
b458351
[ADD] estate : Chapter 12 first part
a700cb5
[ADD] estate : End of chapter 12, estate_account : start of chapter 13
f93bbbc
[ADD] estate_account : Added Chapter 13 features
4e39ac0
[ADD] estate : Chapter 14 features
137f105
[FIX] estate : Implemented reviews
56a7abc
[FIX] estate : style fixes
d6033eb
[FIX] estate : CI/CD styles + contraints
291660e
[ADD] awesome_owl : Added chapter 1 features
0c0f056
[ADD] owl_dashboard : exercise 1, 2 & 3
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,33 @@ | ||
| import { Component } from "@odoo/owl"; | ||
| import { registry } from "@web/core/registry"; | ||
| import { Layout } from "@web/search/layout"; | ||
| import { useService } from "@web/core/utils/hooks"; | ||
| import { DashboardItem } from "./dashboard_item/dashboard_item" | ||
|
|
||
| class AwesomeDashboard extends Component { | ||
| static template = "awesome_dashboard.AwesomeDashboard"; | ||
|
|
||
| static components = { | ||
| Layout, | ||
| DashboardItem | ||
| } | ||
|
|
||
| setup() { | ||
| this.action = useService("action") | ||
| } | ||
|
|
||
|
|
||
| openCustomers() { | ||
| this.action.doAction("base.action_partner_form") | ||
| } | ||
|
|
||
| openLeads() { | ||
| this.action.doAction({ | ||
| type: 'ir.actions.act_window', | ||
| res_model: 'crm.lead', | ||
| views: [[false, 'list'], [false, 'form']] | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .o_dashboard { | ||
| background-color: azure; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
awesome_dashboard/static/src/dashboard_item/dashboard_item.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { Component } from "@odoo/owl"; | ||
|
|
||
| export class DashboardItem extends Component { | ||
| static template = "awesome_dashboard.dashboard_item"; | ||
|
|
||
| static props = { | ||
| size: {type:Number, default: 1}, | ||
| slots: {type: Object, optional: true} | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
awesome_dashboard/static/src/dashboard_item/dashboard_item.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| .card { | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| background: white; | ||
| border-radius: 0.5rem; | ||
| border: none; | ||
| padding: 1rem; | ||
| margin: 2rem | ||
| } |
10 changes: 10 additions & 0 deletions
10
awesome_dashboard/static/src/dashboard_item/dashboard_item.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_dashboard.dashboard_item"> | ||
| <div class="card" t-att-style="'width: calc(18rem * ' + props.size + ');'"> | ||
| <t t-slot="default"/> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { Component, useState } from "@odoo/owl"; | ||
|
|
||
| export class Card extends Component { | ||
| static template = "awesome_owl.card"; | ||
|
|
||
| static props = { | ||
| title: {type: String, validate: val => { | ||
| if(val.length === 0) return false; | ||
|
|
||
| let first = val.substring(0, 1); | ||
| return first === first.toUpperCase(); | ||
| }}, | ||
| slots: {type: Object, optional: true}, | ||
| } | ||
|
|
||
| setup() { | ||
| this.state = useState({open: true}); | ||
| } | ||
|
|
||
| toggle(){ | ||
| this.state.open = !this.state.open; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.card"> | ||
| <div class="card d-inline-block m-2" style="width: 18rem;"> | ||
| <div class="card-body"> | ||
| <div> | ||
| <h5 class="card-title"> | ||
| <t t-esc="props.title"/> | ||
| </h5> | ||
| <button t-on-click="toggle">Toggle</button> | ||
| </div> | ||
| <t t-if="state.open" t-slot="default"/> | ||
| </div> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Component, useState } from "@odoo/owl"; | ||
|
|
||
| export class Counter extends Component { | ||
| static template = "awesome_owl.counter"; | ||
|
|
||
| static props = { | ||
| onChange: {type: Function, optional: true} | ||
| } | ||
|
|
||
| setup() { | ||
| this.state = useState({ value: 1 }); | ||
| } | ||
|
|
||
| increment() { | ||
| this.state.value++; | ||
| this.props?.onChange(this.state.value); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.counter"> | ||
| <p>Counter: <t t-esc="state.value"/></p> | ||
| <button class="btn btn-primary" t-on-click="increment">Increment</button> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,25 @@ | ||
| import { Component } from "@odoo/owl"; | ||
| import { Component, markup, useState } from "@odoo/owl"; | ||
| import { Counter } from "./counter/counter"; | ||
| import { Card } from "./card/card"; | ||
| import { TodoList } from "./todo_list/todo_list"; | ||
|
|
||
| export class Playground extends Component { | ||
| static template = "awesome_owl.playground"; | ||
|
|
||
| someHtml = "<div class='text-primary'>some content</div>" | ||
| markupedHtml = markup(this.someHtml); | ||
|
|
||
| static components = { | ||
| Counter, | ||
| Card, | ||
| TodoList | ||
| }; | ||
|
|
||
| setup() { | ||
| this.state = useState({ sum: 2 }); | ||
| } | ||
|
|
||
| incrementSum() { | ||
| this.state.sum++; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Component } from "@odoo/owl"; | ||
|
|
||
| export class TodoItem extends Component { | ||
| static template = "awesome_owl.todo_item"; | ||
|
|
||
| static props = { | ||
| todo: {type: Object, shape: {id: Number, description: String, isCompleted: Boolean}}, | ||
| toggleState: Function, | ||
| removeTodo: Function | ||
| } | ||
|
|
||
| complete() { | ||
| this.props.toggleState(this.props.todo.id) | ||
| } | ||
|
|
||
| remove() { | ||
| this.props.removeTodo(this.props.todo.id) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.todo_item"> | ||
| <div> | ||
| <input type="checkbox" t-on-click="complete"/> | ||
| <span t-att-class="{'text-muted text-decoration-line-through': props.todo.isCompleted}"><t t-esc="props.todo.id"/></span> | ||
| <span t-att-class="{'text-muted text-decoration-line-through': props.todo.isCompleted}">. </span> | ||
| <span t-att-class="{'text-muted text-decoration-line-through': props.todo.isCompleted}"><t t-esc="props.todo.description"/></span> | ||
| <span t-on-click="remove" class="fa fa-remove"/> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { Component, useState } from "@odoo/owl"; | ||
| import { TodoItem } from "../todo_item/todo_item"; | ||
| import { useAutofocus } from "../util"; | ||
|
|
||
| export class TodoList extends Component { | ||
| static template = "awesome_owl.todo_list"; | ||
|
|
||
| counter = 1; | ||
|
|
||
| static components = { | ||
| TodoItem | ||
| } | ||
|
|
||
| setup() { | ||
| this.todos = useState([]); | ||
| useAutofocus("input"); | ||
| } | ||
|
|
||
| change(id) { | ||
| let found = this.todos.findIndex(t => t.id === id); | ||
| if(found >= 0) this.todos[found] = {...this.todos[found], isCompleted: !this.todos[found].isCompleted}; | ||
| } | ||
|
|
||
| remove(id) { | ||
| let found = this.todos.findIndex(t => t.id === id); | ||
| if(found >= 0) this.todos.splice(found, 1); | ||
| } | ||
|
|
||
| tryAdd(ev) { | ||
| if(ev.keyCode != 13) return; | ||
|
|
||
| let txt = ev.srcElement.value; | ||
| if(txt === "") return; | ||
|
|
||
| this.todos.push({id: this.counter++, description: txt, isCompleted: false}); | ||
| ev.srcElement.value = ""; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.todo_list"> | ||
| <input t-ref="input" t-on-keyup="tryAdd" type="text" placeholder="Enter a new task"/> | ||
| <div t-foreach="todos" t-as="i" t-key="i.id"> | ||
| <TodoItem todo="i" toggleState.bind="change" removeTodo.bind="remove"/> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { useRef, onMounted } from "@odoo/owl"; | ||
|
|
||
| export function useAutofocus(refName) { | ||
| let ref = useRef(refName); | ||
| onMounted(() => { | ||
| ref.el?.focus() | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| 'name': 'Real Estate', | ||
| 'author': 'zavan', | ||
| 'depends': ['base'], | ||
| 'application': True, | ||
| 'license': 'LGPL-3', | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_type_views.xml', | ||
| 'views/estate_property_tag_views.xml', | ||
| 'views/estate_property_offer_views.xml', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_menus.xml', | ||
| 'views/res_users_views.xml' | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type | ||
| from . import estate_property_tag | ||
| from . import estate_property_offer | ||
| from . import res_users |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.