Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["odoo"]
}
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
11 changes: 11 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
'name': "Real Estate",
'application': True,
'installable': True,
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus_views.xml',
]
}
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate_property
42 changes: 42 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from odoo import fields, models
from datetime import timedelta


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Estate property"

name = fields.Char('Name', required=True, default='My new house')
description = fields.Text('Description')
active = fields.Boolean(default=True)
postcode = fields.Char('Postcode')
date_availability = fields.Date('Available From',default=lambda self: fields.Date.today() + timedelta(days=90), copy=False)
expected_price = fields.Float('Expected Price', required=True)
selling_price = fields.Float('Selling Price', readonly=True, copy=False)
bedrooms = fields.Integer('Bedrooms', default=2)
living_area = fields.Integer('Living Area (sqm)')
facades = fields.Integer('#Facades')
garage = fields.Boolean('Garage')
garden = fields.Boolean('Garden')
garden_area = fields.Integer('Garden area')
garden_orientation = fields.Selection(
string='type',
selection=[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')
])
state = fields.Selection(
[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('cancelled', 'Cancelled'),
],
required=True,
copy=False,
default='new',
)

2 changes: 2 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property,access.estate.property,model_estate_property,base.group_user,1,1,1,1
8 changes: 8 additions & 0 deletions estate/views/estate_menus_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<odoo>
<menuitem id="estate_menu_root" name="Estate">
<menuitem id="estate_property_menu" name="Property">
<menuitem id="estate_property_menu_action" action="estate_property_model_action"/>
</menuitem>
</menuitem>
</odoo>
119 changes: 119 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_model_action" model="ir.actions.act_window">
<field name="name">Property</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

<record id="estate_property_view_tree" model="ir.ui.view">
<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Title">
<field name="name" />
<field name="description" />
<field name="bedrooms" />
<field name="living_area" />
<field name="expected_price" />
<field name="selling_price" />
<field name="date_availability" />
</list>
</field>
</record>

<record id="estate_property_view_form" model="ir.ui.view">
<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Estate Property">
<sheet>
<div class="oe_title mb32">
<h1>
<field name="name" class="mb16" />
</h1>
</div>
<group class="d-flex justify-content-between">
<group>
<field name="postcode" class="mb16" />
</group>

<group>
<field name="expected_price" class="mb16" />
</group>
</group>

<group class="d-flex justify-content-between mb32">
<group>
<field name="date_availability" class="mb16" />
</group>

<group>
<field name="selling_price" class="mb16" />
</group>
</group>
<notebook>
<page string="Description">
<group class="d-flex flex-column">
<group>
<field name="description" class="mb4" />
</group>
<group>
<field name="bedrooms" class="mb4" />
</group>
<group>
<field name="living_area" class="mb4" />
</group>
<group>
<field name="facades" class="mb4" />
</group>
<group>
<field name="garage" class="mb4" />
</group>
<group>
<field name="garden" class="mb4" />
</group>
<group>
<field name="garden_area" class="mb4" />
</group>
<group>
<field name="garden_orientation" class="mb4" />
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="estate_property_view_search" model="ir.ui.view">
<field name="name">estate.property.view.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search Properties">
<field name="name" string="Title" />
<field name="postcode" string="Postcode" />
<field name="expected_price" string="Postcode" />
<field name="bedrooms" string="Bedrooms" />
<field name="living_area" string="Living Area" />

<filter
name="available"
string="Available"
domain="[
('active', '=', True)
]"
/>

<group expand="0" string="Group By">
<filter
name="group_by_postcode"
string="Postcode"
context="{'group_by': 'postcode'}"
/>
</group>
</search>
</field>
</record>
</odoo>