-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[ADD] estate: initial module with property management #952
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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
56a3a92
787a31c
0bf8aa8
e3df877
c3e0054
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import controllers | ||
from . import controllers |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': "Awesome Owl", | ||
|
||
'summary': """ | ||
"name": "Awesome Owl", | ||
"summary": """ | ||
Starting module for "Discover the JS framework, chapter 1: Owl components" | ||
""", | ||
|
||
'description': """ | ||
"description": """ | ||
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. unnecessary changes. |
||
Starting module for "Discover the JS framework, chapter 1: Owl components" | ||
""", | ||
|
||
'author': "Odoo", | ||
'website': "https://www.odoo.com", | ||
|
||
"author": "Odoo", | ||
"website": "https://www.odoo.com", | ||
Comment on lines
+9
to
+10
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. unnecessary changes. |
||
# Categories can be used to filter modules in modules listing | ||
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml | ||
# for the full list | ||
'category': 'Tutorials/AwesomeOwl', | ||
'version': '0.1', | ||
|
||
"category": "Tutorials/AwesomeOwl", | ||
"version": "0.1", | ||
# any module necessary for this one to work correctly | ||
'depends': ['base', 'web'], | ||
'application': True, | ||
'installable': True, | ||
'data': [ | ||
'views/templates.xml', | ||
"depends": ["base", "web"], | ||
"application": True, | ||
"installable": True, | ||
"data": [ | ||
"views/templates.xml", | ||
], | ||
'assets': { | ||
'awesome_owl.assets_playground': [ | ||
('include', 'web._assets_helpers'), | ||
'web/static/src/scss/pre_variables.scss', | ||
'web/static/lib/bootstrap/scss/_variables.scss', | ||
'web/static/lib/bootstrap/scss/_maps.scss', | ||
('include', 'web._assets_bootstrap'), | ||
('include', 'web._assets_core'), | ||
'web/static/src/libs/fontawesome/css/font-awesome.css', | ||
'awesome_owl/static/src/**/*', | ||
"assets": { | ||
"awesome_owl.assets_playground": [ | ||
("include", "web._assets_helpers"), | ||
"web/static/src/scss/pre_variables.scss", | ||
"web/static/lib/bootstrap/scss/_variables.scss", | ||
"web/static/lib/bootstrap/scss/_maps.scss", | ||
("include", "web._assets_bootstrap"), | ||
("include", "web._assets_core"), | ||
"web/static/src/libs/fontawesome/css/font-awesome.css", | ||
"awesome_owl/static/src/**/*", | ||
], | ||
}, | ||
'license': 'AGPL-3' | ||
"license": "AGPL-3", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import controllers | ||
from . import controllers |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
|
||
export class Card extends Component { | ||
static template = "awesome_owl.Card"; | ||
static props = { | ||
title : { type : String}, | ||
slots: { type: Object, optional: true }, | ||
} | ||
|
||
setup() { | ||
this.toggle = useState({ value : true }); | ||
} | ||
|
||
onToggle() { | ||
this.toggle.value = !this.toggle.value; | ||
} | ||
} | ||
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. Should be one empty line at the end of the file. |
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.Card"> | ||
<div class="card d-inline-block m-2" style="width: 18rem;"> | ||
<div class="card-body"> | ||
<h5 class="card-title"><t t-out="props.title"/></h5> | ||
<button class="btn btn-primary" t-on-click="onToggle" >Toggle</button> | ||
</div> | ||
<t t-if="toggle.value" t-slot="default"/> | ||
</div> | ||
</t> | ||
|
||
</templates> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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.counter = useState({ value : 0 }) | ||
} | ||
|
||
increment() { | ||
this.counter.value++; | ||
if (this.props.onChange) { | ||
this.props.onChange(); | ||
} | ||
} | ||
} |
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.Counter"> | ||
<div class="m-2 p-2 border d-inline-block"> | ||
<span class="me-2">Counter: <t t-esc="counter.value"/></span> | ||
<button class="btn btn-primary" t-on-click="increment" style="background-color: purple; color: white;">Increment</button> | ||
</div> | ||
</t> | ||
|
||
</templates> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
/** @odoo-module **/ | ||
|
||
import { Component } from "@odoo/owl"; | ||
import { Component, useState, markup } from "@odoo/owl"; | ||
import { Counter } from "./counter/counter"; | ||
import { Card } from "./card/card"; | ||
import { TodoList } from "./todo/todo_list"; | ||
|
||
export class Playground extends Component { | ||
static template = "awesome_owl.playground"; | ||
static components = { Counter, Card, TodoList }; | ||
|
||
setup() { | ||
this.state = useState( { value:0 } ); | ||
this.content1 = "<b>hello content1</b>"; | ||
this.content2 = markup("<b>hello content2</b>"); | ||
} | ||
|
||
incrementSum() { | ||
this.state.value++; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
|
||
export class TodoItem extends Component { | ||
static template = "awesome_owl.TodoItem"; | ||
static props = { | ||
todo : { type : Object }, | ||
toggleState : { type : Function}, | ||
removeTodo : { type : Function} | ||
} | ||
|
||
onChange(todoId) { | ||
this.props.toggleState(todoId); | ||
} | ||
|
||
onRemove(todoId) { | ||
this.props.removeTodo(todoId); | ||
} | ||
} | ||
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. Should be one empty line at the end of the file. |
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_owl.TodoItem"> | ||
<div t-att-class="{'text-muted text-decoration-line-through': props.todo.isCompleted}"> | ||
<input type="checkbox" name="status" t-att-checked="props.todo.isCompleted" t-on-change="() => this.onChange(props.todo.id)"/> | ||
<t t-esc="props.todo.id"/>. <t t-esc="props.todo.description"/> | ||
<span class="fa fa-remove" t-on-click="() => this.onRemove(props.todo.id)"/> | ||
</div> | ||
</t> | ||
|
||
</templates> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Component, useState, useRef } from "@odoo/owl"; | ||
import { TodoItem } from "./todo_item"; | ||
import { useAutofocus } from "../utils" | ||
|
||
export class TodoList extends Component { | ||
static template = "awesome_owl.TodoList"; | ||
static components = { TodoItem }; | ||
|
||
setup(){ | ||
this.todos = useState([]); | ||
useAutofocus('input'); | ||
} | ||
|
||
addTodo(ev){ | ||
if (ev.keyCode === 13 && ev.target.value) { | ||
this.todos.push({ | ||
id: this.todos.length + 1, | ||
description: ev.target.value, | ||
isCompleted: false | ||
}); | ||
} | ||
} | ||
|
||
inputStatus(todoId) { | ||
const todo = this.todos.find(item => item.id === todoId); | ||
todo.isCompleted = !todo.isCompleted; | ||
} | ||
|
||
removeTodo(todoId){ | ||
const index = this.todos.findIndex(item => item.id === todoId); | ||
this.todos.splice(index, 1); | ||
} | ||
} | ||
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. Should be one empty line at the end of the file. |
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="awesome_owl.TodoList"> | ||
<div class="d-inline-block border p-2 m-2"> | ||
<input placeholder="Add a todo" t-on-keyup="addTodo" t-ref="input" /> | ||
<t t-foreach="todos" t-as="todo" t-key="todo.id"> | ||
<TodoItem todo="todo" toggleState.bind="inputStatus" removeTodo.bind="removeTodo"/> | ||
</t> | ||
</div> | ||
</t> | ||
|
||
</templates> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useRef, onMounted } from "@odoo/owl"; | ||
|
||
export function useAutofocus(refName) { | ||
const ref = useRef(refName); | ||
onMounted(() => { | ||
ref.el.focus(); | ||
}); | ||
} | ||
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. Should be one empty line at the end of the file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Real Estate", | ||
"version": "0.1", | ||
"depends": ["base"], | ||
"author": "Madhav Pancholi", | ||
"category": "Real Estate", | ||
"description": """ | ||
Manage properties, rentals, and real estate sales. | ||
""", | ||
"installable": True, | ||
"application": True, | ||
"data": [ | ||
"data/auto_reject_offer_cron.xml", | ||
"security/ir.model.access.csv", | ||
"security/demo_group.xml", | ||
"security/salesperson_own_records_rule.xml", | ||
"views/estate_property_view.xml", | ||
"views/estate_property_type_view.xml", | ||
"views/estate_property_tag_view.xml", | ||
"views/estate_menus.xml", | ||
"views/res_users_view.xml", | ||
], | ||
"demo": [], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="ir_cron_auto_reject_offer" model="ir.cron"> | ||
<field name="name">Offers: Reject Offer Once validity expires</field> | ||
<field name="interval_number">1</field> | ||
<field name="interval_type">days</field> | ||
<field name="model_id" ref="model_estate_property_offer"/> | ||
<field name="code">model._auto_reject_offer()</field> | ||
<field name="state">code</field> | ||
</record> | ||
</odoo> | ||
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. Should be one empty line at the end of the file. |
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 |
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.
unnecessary changes.