-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
18.0 tutorial drod #178
Open
vandroogenbd
wants to merge
9
commits into
odoo:18.0
Choose a base branch
from
odoo-dev:18.0-tutorial-drod
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
18.0 tutorial drod #178
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c61bcc4
[ADD] estate: Finish up to chapter 10 (included)
vandroogenbd e7b73dc
[IMP] estate: Finish up to Chapter 12
vandroogenbd e889b60
[FIX] estate: Fix reference errors in views
vandroogenbd 0f0cd1a
[IMP] estate: Finish Chapter 12
vandroogenbd 55bc134
[ADD] estate: Add estate_account model, finish Chapter 13
vandroogenbd 9472a65
[IMP] estate: Add a (somewhat decent) kanban view & fix warnings
vandroogenbd 9d9e624
[IMP] estate: Make runbot's style checking happy
vandroogenbd e749a1d
[ADD] awesome_owl: Finish Chapter 6
vandroogenbd e2bbeeb
[ADD] awesome_owl: Finish Chapter 7
vandroogenbd 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 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 |
---|---|---|
|
@@ -38,5 +38,6 @@ | |
'awesome_owl/static/src/**/*', | ||
], | ||
}, | ||
'license': 'AGPL-3' | ||
'license': 'AGPL-3', | ||
'auto_install': True | ||
} |
This file contains 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 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component } from "@odoo/owl"; | ||
|
||
export class Card extends Component { | ||
static template = "awesome_owl.card"; | ||
|
||
static props = ['title', 'content']; | ||
} |
This file contains 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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates xml:space="preserve"> | ||
|
||
<t t-name="awesome_owl.card"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> | ||
<t t-out="props.title"/> | ||
</h5> | ||
<p class="card-text"> | ||
<t t-out="props.content"/> | ||
</p> | ||
</div> | ||
</t> | ||
|
||
</templates> |
This file contains 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,21 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component, useState, xml } from "@odoo/owl"; | ||
|
||
export class Counter extends Component { | ||
static template = "awesome_owl.counter"; | ||
|
||
static props = { | ||
onChange: { type: Function } | ||
}; | ||
|
||
setup() { | ||
this.state = useState({ value: 1 }); | ||
} | ||
|
||
increment() { | ||
this.state.value++; | ||
if (this.props.onChange) | ||
this.props.onChange(); | ||
} | ||
} |
This file contains 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" callback.bind="props.onChange"> | ||
<p>Count: <t t-esc="this.state.value"/></p> | ||
<button class="btn btn-primary" t-on-click="increment">Increment</button> | ||
</t> | ||
|
||
</templates> |
This file contains 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,27 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component } from "@odoo/owl"; | ||
import { Component, markup, useState } from "@odoo/owl"; | ||
|
||
// Custom elements | ||
import { Card } from "./card/card"; | ||
import { Counter } from "./counter/counter"; | ||
import { TodoList } from "./todo/todolist"; | ||
|
||
export class Playground extends Component { | ||
static template = "awesome_owl.playground"; | ||
|
||
static components = { Card, Counter, TodoList }; | ||
|
||
setup() { | ||
this.card_contents = [ | ||
{ title: "Title 1", content: "<div>Text content 1</div>" }, | ||
{ title: "Title 2", content: markup("<div>Text content 2</div>") } | ||
]; | ||
|
||
this.state = useState({ total: 2}); | ||
} | ||
|
||
incrementSum() { | ||
this.state.total++; | ||
} | ||
} |
This file contains 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 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 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component, useState, xml } from "@odoo/owl"; | ||
|
||
export class TodoItem extends Component { | ||
static template = "awesome_owl.todoitem"; | ||
|
||
} |
This file contains 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.todoitem"> | ||
<div t-att-class="{'text-muted text-decoration-line-through': props.isCompleted}"> | ||
<t t-esc="props.id" />. <t t-esc="props.description" /> | ||
</div> | ||
</t> | ||
</templates> |
This file contains 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,32 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component, onMounted, useRef, useState } from "@odoo/owl"; | ||
// Custom elements | ||
import { TodoItem } from "./todoitem"; | ||
import { autoFocus } from "../utils"; | ||
|
||
export class TodoList extends Component { | ||
static template = "awesome_owl.todolist"; | ||
static components = { TodoItem }; | ||
|
||
nextID; | ||
|
||
setup() { | ||
this.nextID = 1; | ||
|
||
this.todos = useState([]); | ||
autoFocus("user_input"); | ||
} | ||
|
||
addTodo(event) { | ||
if (event.keyCode === 13 && event.target.value != '') { | ||
this.todos.push({ | ||
id: this.nextID, | ||
description: event.target.value, | ||
isCompleted: false | ||
}); | ||
this.nextID++; | ||
event.target.value = ""; | ||
} | ||
} | ||
} |
This file contains 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_owl.todolist"> | ||
<input type="text" t-on-keyup="addTodo" placeholder="Add an item to the todo list" t-ref="user_input"/> | ||
<t t-foreach="this.todos" t-as="i" t-key="i.id"> | ||
<TodoItem id="i['id']" description="i['description']" isCompleted="i['isCompleted']"/> | ||
</t> | ||
</t> | ||
</templates> |
This file contains 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 autoFocus(refName) { | ||
const input_ref = useRef(refName); | ||
|
||
onMounted(() => { | ||
input_ref.el.focus(); | ||
}); | ||
} |
This file contains 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 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,25 @@ | ||
# A custom real estate module, created for learning purposes | ||
|
||
{ | ||
'name': '[TUTO] Estate', | ||
'summary': 'Track your real estate properties', | ||
'depends': [ | ||
'base_setup' | ||
], | ||
'license': "LGPL-3", | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
|
||
'views/estate_property_views.xml', | ||
'views/estate_property_offer_views.xml', | ||
'views/estate_settings_views.xml', | ||
'views/res_user_views.xml', | ||
'views/estate_menu_views.xml' | ||
], | ||
'installable': True, | ||
'application': True, | ||
'demo': [ | ||
"demo/estate_demo.xml", | ||
], | ||
'auto_install': True | ||
} |
This file contains 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,121 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
<data> | ||
|
||
<!-- Demo Estate Property Types --> | ||
<record id="estate_property_type_1" model="estate_property_type"> | ||
<field name="name">Appartment</field> | ||
</record> | ||
<record id="estate_property_type_2" model="estate_property_type"> | ||
<field name="name">House</field> | ||
</record> | ||
|
||
<!-- Demo Estate Property Tags --> | ||
<record id="estate_property_tag_1" model="estate_property_tag"> | ||
<field name="name">cosy</field> | ||
<field name="color">5</field> | ||
</record> | ||
<record id="estate_property_tag_2" model="estate_property_tag"> | ||
<field name="name">renovated</field> | ||
<field name="color">3</field> | ||
</record> | ||
<record id="estate_property_tag_3" model="estate_property_tag"> | ||
<field name="name">renovation needed</field> | ||
<field name="color">4</field> | ||
</record> | ||
|
||
<!-- Demo Estate Properties --> | ||
<record id="estate_property_1" model="estate_property"> | ||
<field name="name">Beach House</field> | ||
<field name="status">new</field> | ||
<field name="description">A brand new house by the beach</field> | ||
<field name="postcode">8300</field> | ||
<field name="date_availability" eval="(DateTime.today() + relativedelta(months=3)).strftime('%Y-%m-%d %H:%M')" /> | ||
<field name="expected_price">2500000</field> | ||
<field name="selling_price">0</field> | ||
<field name="bedrooms">6</field> | ||
<field name="living_area">1050</field> | ||
<field name="facades">4</field> | ||
<field name="garage">True</field> | ||
<field name="garden">True</field> | ||
<field name="garden_area">420</field> | ||
<field name="garden_orientation">south</field> | ||
<field name="type_id" ref="estate_property_type_2" /> | ||
<field name="salesperson" ref="base.user_demo"/> | ||
<field name="tag_ids" eval="[(6, 0, [ref('estate_property_tag_1'), ref('estate_property_tag_2')])]"/> | ||
</record> | ||
<record id="estate_property_2" model="estate_property"> | ||
<field name="name">City Apt</field> | ||
<field name="status">offer_accepted</field> | ||
<field name="description">A shitty appartment in Brussels</field> | ||
<field name="postcode">1090</field> | ||
<field name="date_availability" eval="(DateTime.today() + relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')" /> | ||
<field name="expected_price">250000</field> | ||
<field name="selling_price">0</field> | ||
<field name="bedrooms">2</field> | ||
<field name="living_area">95</field> | ||
<field name="facades">1</field> | ||
<field name="garage">False</field> | ||
<field name="garden">False</field> | ||
<field name="garden_area">0</field> | ||
<field name="type_id" ref="estate_property_type_1"/> | ||
<field name="salesperson" ref="base.user_admin"/> | ||
<field name="tag_ids" eval="[(6, 0, [ref('estate_property_tag_3')])]"/> | ||
</record> | ||
<record id="estate_property_3" model="estate_property"> | ||
<field name="name">Small House</field> | ||
<field name="status">new</field> | ||
<field name="description">A small house in the centre of Brussels</field> | ||
<field name="postcode">1000</field> | ||
<field name="date_availability" eval="(DateTime.today() + relativedelta(days=5, months=3)).strftime('%Y-%m-%d %H:%M')" /> | ||
<field name="expected_price">450000</field> | ||
<field name="selling_price">0</field> | ||
<field name="bedrooms">2</field> | ||
<field name="living_area">120</field> | ||
<field name="facades">2</field> | ||
<field name="garage">True</field> | ||
<field name="garden">False</field> | ||
<field name="garden_area">0</field> | ||
<field name="type_id" ref="estate_property_type_2"/> | ||
<field name="salesperson" ref="base.user_admin"/> | ||
<field name="tag_ids" eval="[(6, 0, [ref('estate_property_tag_1'), ref('estate_property_tag_3')])]"/> | ||
</record> | ||
|
||
<!-- Demo Estate Property Offers --> | ||
<record id="estate_property_offer_1" model="estate_property_offer"> | ||
<field name="price">2000000</field> | ||
<field name="partner_id" ref="base.res_partner_4"/> | ||
<field name="validity">12</field> | ||
<field name="property_id" ref="estate_property_1"/> | ||
</record> | ||
<record id="estate_property_offer_2" model="estate_property_offer"> | ||
<field name="price">200000</field> | ||
<field name="partner_id" ref="base.res_partner_3"/> | ||
<field name="validity">10</field> | ||
<field name="property_id" ref="estate_property_2"/> | ||
</record> | ||
<record id="estate_property_offer_3" model="estate_property_offer"> | ||
<field name="price">220000</field> | ||
<field name="partner_id" ref="base.res_partner_5"/> | ||
<field name="validity">25</field> | ||
<field name="property_id" ref="estate_property_2"/> | ||
</record> | ||
<record id="estate_property_offer_4" model="estate_property_offer"> | ||
<field name="price">260000</field> | ||
<field name="status">accepted</field> | ||
<field name="partner_id" ref="base.res_partner_4"/> | ||
<field name="deadline" eval="(DateTime.today() + relativedelta(days=7)).strftime('%Y-%m-%d %H:%M')" /> | ||
<field name="property_id" ref="estate_property_2"/> | ||
</record> | ||
|
||
<!-- Mass cancel --> | ||
<record id="model_estate_property_action_cancel" model="ir.actions.server"> | ||
<field name="name">Mass cancel</field> | ||
<field name="model_id" ref="estate.model_estate_property"/> | ||
<field name="binding_model_id" ref="estate.model_estate_property"/> | ||
<field name="binding_view_types">list</field> | ||
<field name="state">code</field> | ||
<field name="code">action = records.action_cancel()</field> | ||
</record> | ||
</data> | ||
</odoo> |
This file contains 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 estate_property_infos, estate_property, estate_property_offer, res_user | ||
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.
Better to give each its own line: clearer and later, if some files have been added, people can find more easily who was at the origin of a specific file with a git blame