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
1 change: 1 addition & 0 deletions real_estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions real_estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Real Estate Application",
"summary": "This is a custom real estate application for understanding Odoo",
"description": "This is a custom real estate application for understanding Odoo",
"author": "Odoo S.A.",
"website": "https://www.odoo.com",
"category": "Tutorials",
"version": "0.1",
"application": True,
"data": [
"data/res_estate_data.xml",
"security/ir.model.access.csv",
"views/estate_property_templates.xml",
"views/estate_property_type_templates.xml",
"views/estate_property_tags_templates.xml",
"views/estate_menu.xml",
],
"assets": {},
"license": "AGPL-3",
}
65 changes: 65 additions & 0 deletions real_estate/data/res_estate_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="type_1" model="estate.property.type">
<field name="name">House</field>
</record>
<record id="property_1" model="estate.property">
<field name="name">Property 1</field>
<field name="description">Description 1</field>
<field name="postcode">1000</field>
<field name="expected_price">10000</field>
<field name="selling_price">9000</field>
<field name="active">True</field>
<field name="bedrooms">2</field>
<field name="living_area">2</field>
<field name="facades">2</field>
<field name="garage">True</field>
<field name="garden">True</field>
<field name="garden_area">22</field>
<field name="state">new</field>
<field name="garden_orientation">north</field>
<field name="property_type" ref="type_1"/>
</record>
<record id="type_2" model="estate.property.type">
<field name="name">Apartment</field>
</record>
<record id="property_2" model="estate.property">
<field name="name">Property 2</field>
<field name="description">Description 2</field>
<field name="postcode">2000</field>
<field name="expected_price">10000</field>
<field name="selling_price">9000</field>
<field name="active">True</field>
<field name="bedrooms">2</field>
<field name="living_area">2</field>
<field name="facades">2</field>
<field name="garage">True</field>
<field name="garden">True</field>
<field name="garden_area">22</field>
<field name="state">new</field>
<field name="garden_orientation">north</field>
<field name="property_type" ref="type_2"/>
</record>
<record id="type_3" model="estate.property.type">
<field name="name">Castle</field>
</record>
<record id="property_3" model="estate.property">
<field name="name">Property 3</field>
<field name="description">Description 3</field>
<field name="postcode">1040</field>
<field name="expected_price">10000</field>
<field name="selling_price">9000</field>
<field name="active">True</field>
<field name="bedrooms">2</field>
<field name="living_area">2</field>
<field name="facades">2</field>
<field name="garage">True</field>
<field name="garden">True</field>
<field name="garden_area">22</field>
<field name="state">new</field>
<field name="garden_orientation">north</field>
<field name="property_type" ref="type_3"/>
</record>
</data>
</odoo>
4 changes: 4 additions & 0 deletions real_estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tags
from . import estate_property_offers
60 changes: 60 additions & 0 deletions real_estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from datetime import date

from dateutil.relativedelta import relativedelta
from odoo import fields, models


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

name = fields.Char(string="Name", required=True)
description = fields.Text(string="Description")
postcode = fields.Char(string="Postcode")
date_availability = fields.Datetime(
string="Date Availability",
default=lambda self: date.today() + relativedelta(months=3),
copy=False,
)
expected_price = fields.Float(string="Expected Price", required=True)
selling_price = fields.Float(string="Selling Price", readonly=True, copy=False)
active = fields.Boolean(string="Active", default=True)
bedrooms = fields.Integer(string="Bedrooms", default=2)
living_area = fields.Integer(string="Living Area")
facades = fields.Integer(string="Facades")
garage = fields.Boolean(string="Garage")
garden = fields.Boolean(string="Garden")
garden_area = fields.Integer(string="Garden Area")
state = fields.Selection(
string="State",
selection=[
('new', "New"),
('offered', "Offer Received"),
('accepted', "Offer Accepted"),
('sold', "Sold"),
('cancelled', "Cancelled"),
],
required=True,
copy=False,
)
garden_orientation = fields.Selection(
[
('north', "North"),
('south', "South"),
('east', "East"),
('west', "West"),
]
)
sales_person = fields.Many2one(
'res.users',
string="Sales Person",
copy=False,
default=lambda self: self.env.user,
)
buyer = fields.Many2one('res.partner', string="Buyer")
property_type = fields.Many2one(
comodel_name="estate.property.type",
String="Property Type",
)
tags = fields.Many2many('estate.property.tags', string="Tags")
offer_ids = fields.One2many('estate.property.offers', 'property_id', string="Offers")
22 changes: 22 additions & 0 deletions real_estate/models/estate_property_offers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from odoo import fields, models


class EstatePropertyOffers(models.Model):
_name = "estate.property.offers"
_description = "Real Estate Property Offers"

price = fields.Float(string="Price")
status = fields.Selection(
string="Status",
selection=[('accepted', "Accepted"), ('rejected', "Rejected")],
required=True,
copy=False,
)
partner_id = fields.Many2one(
comodel_name='res.partner',
required=True,
)
property_id = fields.Many2one(
comodel_name='estate.property',
required=True,
)
8 changes: 8 additions & 0 deletions real_estate/models/estate_property_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyTags(models.Model):
_name = "estate.property.tags"
_description = "Real Estate Property Tags"

name = fields.Char(string="Name", required=True)
8 changes: 8 additions & 0 deletions real_estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Real Estate Property Type"

name = fields.Char(string="Name", required=True)
5 changes: 5 additions & 0 deletions real_estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
access_estate_property_type,access.estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tags,access.estate.property.tags,model_estate_property_tags,base.group_user,1,1,1,1
access_estate_property_offers,access.estate.property.offers,model_estate_property_offers,base.group_user,1,1,1,1
7 changes: 7 additions & 0 deletions real_estate/views/estate_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<odoo>
<menuitem id="estate_menu_root" name="Real Estate"/>
<menuitem id="estate_menu_action" action="test_model_action" parent="estate_menu_root" sequence="1"/>
<menuitem id="estate_menu_config" name="Settings" parent="estate_menu_root"/>
<menuitem id="estate_property_type_menu_action" action="property_type_action" parent="estate_menu_config"/>
<menuitem id="estate_property_tag_menu_action" action="property_tag_action" parent="estate_menu_config"/>
</odoo>
14 changes: 14 additions & 0 deletions real_estate/views/estate_property_offer_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<odoo>
<record id="property_type_view_tree" model="ir.ui.view">
<field name="name">estate.property.offer.list</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<list string="Property Offer">
<field name="price"/>
<field name="partner_id" string="Partner"/>
<field name="status"/>
</list>
</field>
</record>
</odoo>
17 changes: 17 additions & 0 deletions real_estate/views/estate_property_tags_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo>
<record id="property_tag_action" model="ir.actions.act_window">
<field name="name">Property Tags</field>
<field name="res_model">estate.property.tags</field>
<field name="view_mode">list,form</field>
</record>
<record id="property_type_view_tree" model="ir.ui.view">
<field name="name">estate.property.tags.list</field>
<field name="model">estate.property.tags</field>
<field name="arch" type="xml">
<list string="Estate">
<field name="name"/>
</list>
</field>
</record>
</odoo>
93 changes: 93 additions & 0 deletions real_estate/views/estate_property_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0"?>
<odoo>
<record id="test_model_action" model="ir.actions.act_window">
<field name="name">Properties</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form,search</field>
</record>
<record id="estate_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="Estate">
<field name="name"/>
<field name="description"/>
<field name="postcode"/>
<field name="garden_area"/>
</list>
</field>
</record>
<record id="estate_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 Form">
<sheet>
<notebook>
<page string="Primary Details">
<h1 class="mb32">
<span class="o_stat_text">Primary Details</span>
</h1>
<group>
<field name="name"/>
<field name="description"/>
<field name="tags" widget="many2many_tags"/>
</group>
<h1 class="mb32">
<span class="o_stat_text">Property Details</span>
</h1>
<group>
<field name="property_type"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<field name="state"/>
<field name="garden_orientation"/>
</group>
<h1 class="mb32">
<span class="o_stat_text">Availability Details</span>
</h1>
<group>
<field name="postcode"/>
<field name="date_availability" eval="DateTime.now()"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="active"/>
</group>
</page>
<page string="Buyer &amp; Sales">
<group>
<field name="sales_person" string="Sales Person"/>
<field name="buyer" string="Buyer"/>
</group>
</page>
<page string="Offers">
<group>
<field name="offer_ids"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_estate_search" model="ir.ui.view">
<field name="name">estate.property.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search>
<field name="name" string="Estate Name"/>
<field name="description"/>
<field name="active"/>
<field name="postcode"/>
<filter string="Archived" name="active" domain="[('active', '=', False)]"/>
<group>
<filter name="postcode" string="Postcode" context="{'group_by':'postcode'}"/>
</group>
</search>
</field>
</record>
</odoo>
17 changes: 17 additions & 0 deletions real_estate/views/estate_property_type_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo>
<record id="property_type_action" model="ir.actions.act_window">
<field name="name">Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form,search</field>
</record>
<record id="property_type_view_tree" model="ir.ui.view">
<field name="name">estate.property.type.list</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<list string="Estate">
<field name="name"/>
</list>
</field>
</record>
</odoo>