-
Notifications
You must be signed in to change notification settings - Fork 2k
18.0 server tutorial frva #737
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
frva-odoo
wants to merge
22
commits into
odoo:18.0
Choose a base branch
from
odoo-dev:18.0-server-tutorial-frva
base: 18.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
c12884e
[IMP] estate: End of chapter 4 commit
frva-odoo d7696ab
[IMP] estate: End of Chapter 5
frva-odoo 8c00a6e
[IMP] estate: End of chapter 6
frva-odoo 4c39311
[FIX] estate: Clean code and correction of reported issues
frva-odoo 6f18a4b
[IMP] estate: End of chapter 7
frva-odoo 438818c
[IMP] estate: End of day 2
frva-odoo dbbf98e
[IMP] estate: End of chapter 8
frva-odoo d1cf2bc
[IMP] estate: End of chapter 9
frva-odoo ecd1179
[IMP] estate: End of chapter 11
frva-odoo d9ff057
[IMP] estate: End of chapter 12
frva-odoo 10d9c53
[ADD] estate_account: end of tutorial chapter 13
frva-odoo 0475bd5
[IMP] estate: End of tutorial chapter 14
frva-odoo dda9737
[FIX] estate,estate_account: Correction of issues
frva-odoo 4f9e253
[IMP] awesome_owl: component, subcomponent and props
frva-odoo 89d84e7
[IMP] awesome_owl: markup, props validation and callback prop
frva-odoo 7dd734d
[IMP] awesome_owl: todo, dynamic attributes and adding todos
frva-odoo 5c6eb35
[IMP] awesome_owl: focusing input, togglin and deleting todos
frva-odoo 3f63141
[IMP] awesome_owl: generic cards and minimizing
frva-odoo ea5a464
[IMP] awesome_dashboard: a new layout
frva-odoo d48b0ae
[IMP] awesome_dashboard: Add some buttons for quick navigation (2)
frva-odoo 5a12840
[IMP] awesome_dashboard: Add a dashboard item (3)
frva-odoo 1b8a7ab
[FIX] awesome_owl, awesome_dashboard, estate_account: correction of r…
frva-odoo 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
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,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import controllers |
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,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': "Awesome Dashboard", | ||
|
||
|
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,10 +1,34 @@ | ||
/** @odoo-module **/ | ||
|
||
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"; | ||
|
||
|
||
class AwesomeDashboard extends Component { | ||
static template = "awesome_dashboard.AwesomeDashboard"; | ||
static components = { Layout, DashboardItem }; | ||
|
||
setup(){ | ||
this.myDisplay = {controlPanel: {}}; | ||
this.action = useService("action"); | ||
} | ||
|
||
openCustomersView(){ | ||
this.action.doAction("base.action_partner_form"); | ||
} | ||
|
||
openLeads(){ | ||
this.action.doAction({ | ||
type: 'ir.actions.act_window', | ||
name: 'All leads', | ||
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: rgb(124, 124, 190); | ||
} |
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,24 @@ | ||
|
||
import { Component } from "@odoo/owl"; | ||
|
||
|
||
export class DashboardItem extends Component { | ||
static template = "awesome_dashboard.dashboard_item"; | ||
static props = { | ||
slots: Object, | ||
size: { | ||
type: Number, | ||
optional: true | ||
} | ||
}; | ||
|
||
|
||
calculate_width(){ | ||
if (this.props.size){ | ||
this.width = (18*this.props.size) | ||
}else{ | ||
this.width = 18 | ||
} | ||
return this.width | ||
} | ||
} |
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
|
||
<t t-name="awesome_dashboard.dashboard_item"> | ||
<div class="card m-2 border-dark" t-attf-style="width: {{18*props.size}}rem;"> | ||
<div class="card-body"> | ||
<t 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,20 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
|
||
export class Card extends Component { | ||
static template = "Card"; | ||
static props = { | ||
title: String, | ||
slots: { | ||
type: Object, | ||
optional: true, | ||
} | ||
}; | ||
|
||
setup(){ | ||
this.state = useState({ open: true }); | ||
} | ||
|
||
changeOpenState(){ | ||
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
|
||
<t t-name="Card"> | ||
<div class="card d-inline-block m-2" style="width: 18rem;"> | ||
<div class="card-body"> | ||
<h5> | ||
<t class="card-title" t-esc="props.title"/> | ||
<span class="fa fa-bars" t-on-click="changeOpenState"/> | ||
</h5> | ||
<p><t t-if="state.open" t-slot="default"/></p> | ||
</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,17 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
|
||
export class Counter extends Component { | ||
static template = "Counter"; | ||
static props = { | ||
onChange: {type: Function, optional: true} | ||
} | ||
|
||
setup() { | ||
this.state = useState({ value: 0 }); | ||
} | ||
|
||
increment(){ | ||
this.state.value++; | ||
this.props.onChange?.(); | ||
} | ||
} |
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="Counter"> | ||
Counter: <t t-esc="state.value"/> | ||
<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,7 +1,22 @@ | ||
/** @odoo-module **/ | ||
import { Component, useState, markup } from "@odoo/owl"; | ||
import { Counter } from "./counter/counter"; | ||
import { Card } from "./card/card"; | ||
import { TodoList } from "./todolist/todolist"; | ||
|
||
import { Component } from "@odoo/owl"; | ||
|
||
export class Playground extends Component { | ||
static template = "awesome_owl.playground"; | ||
static components = { Counter, Card, TodoList }; | ||
static props = []; | ||
|
||
setup(){ | ||
this.state = useState({ title: "string", content: "string" }); | ||
this.html_value_1 = "<div>some text 1</div>"; | ||
this.html_value_2 = markup("<div>some text 2</div>"); | ||
this.sum = useState({ value: 4 }) | ||
} | ||
|
||
incrementSum(){ | ||
this.sum.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 |
---|---|---|
|
@@ -3,7 +3,15 @@ | |
|
||
<t t-name="awesome_owl.playground"> | ||
<div class="p-3"> | ||
hello world | ||
hello world <Counter onChange.bind="incrementSum"/><Counter onChange.bind="incrementSum"/><Counter onChange.bind="incrementSum"/><br/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newlines are free don't worry 🙃 |
||
<Card title="'cool title'"> | ||
<Counter onChange.bind="incrementSum"/> | ||
</Card> | ||
<Card title="'boring title'"> | ||
Some text egjpojges | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. segjopjge |
||
</Card> | ||
<p>The sum is : <t t-esc="sum.value"/></p> | ||
<p><TodoList/></p> | ||
</div> | ||
</t> | ||
|
||
|
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 } from "@odoo/owl"; | ||
|
||
export class TodoItem extends Component { | ||
static template = "TodoItem"; | ||
static props = ["todo","onDelete"]; | ||
|
||
setup(){ | ||
this.toggleState = this.toggleState.bind(this); | ||
} | ||
|
||
toggleState(){ | ||
this.props.todo.isCompleted = !this.props.todo.isCompleted; | ||
} | ||
|
||
deleteTodo(){ | ||
this.props.onDelete(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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
|
||
<t t-name="TodoItem"> | ||
<div t-att-class="{'text-muted text-decoration-line-through':props.todo.isCompleted}"> | ||
<input type="checkbox" t-att="{'checked': props.todo.isCompleted}" t-on-change="toggleState"/> | ||
<t t-esc="props.todo.id"/>. | ||
<t t-esc="props.todo.description"/> | ||
<span class="fa fa-remove" t-on-click="deleteTodo" icon="fa-close"/> | ||
</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,34 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
import { TodoItem } from "./todoitem"; | ||
import { UseAutofocus } from "../utils"; | ||
|
||
export class TodoList extends Component { | ||
static template = "TodoList"; | ||
static components = { TodoItem }; | ||
static props = []; | ||
|
||
setup(){ | ||
this.todos = useState([]); | ||
this.nextId = 1; | ||
UseAutofocus("todo_input"); | ||
} | ||
|
||
addTodo(ev){ | ||
if (ev.keyCode == 13 && ev.target.value != ""){ | ||
this.todos.push({ | ||
id: this.nextId, | ||
description: ev.target.value, | ||
isCompleted: false | ||
}); | ||
this.nextId++; | ||
ev.target.value = ""; | ||
} | ||
} | ||
|
||
removeTodo(todoId){ | ||
const todoIdInArray = this.todos.findIndex((todo) => todo.id == todoId); | ||
if (todoIdInArray >= 0) { | ||
this.todos.splice(todoIdInArray, 1); | ||
} | ||
} | ||
} |
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="TodoList"> | ||
<p><input placeholder="Enter a new task" t-on-keyup="event => this.addTodo(event)" t-ref="todo_input"/></p> | ||
<t t-foreach="todos" t-as="todo" t-key="todo.id"> | ||
<TodoItem todo="todo" onDelete.bind="removeTodo"/> | ||
</t> | ||
</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,9 @@ | ||
import { useRef, onMounted } from "@odoo/owl"; | ||
|
||
|
||
export function UseAutofocus(refString){ | ||
const inputRef = useRef(refString); | ||
onMounted(() => { | ||
inputRef.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,18 @@ | ||
{ | ||
'name': 'frva-estate', | ||
'license': 'LGPL-3', | ||
'depends': [ | ||
'base' | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'views/estate_property_views.xml', | ||
'views/estate_property_type_views.xml', | ||
'views/estate_property_tag_views.xml', | ||
'views/estate_property_offer_views.xml', | ||
'views/estate_menus.xml', | ||
'views/inherited_users_view.xml' | ||
], | ||
'installable': True, | ||
'application': True | ||
} |
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 inherited_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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use this anywhere?