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
2 changes: 2 additions & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models

15 changes: 15 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
'name': 'Real Estate',
'depends': ['base'],
'license': 'AGPL-3',
'application': True,
'installable': True,
'author': 'Odoo S.A.',
'category':'Tutorials',
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus.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
40 changes: 40 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from odoo import models, fields
from dateutil.relativedelta import relativedelta


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

name = fields.Char(required=True)
description = fields.Text("Description")
postcode = fields.Char("Postcode", required=True)
date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3))
expected_price = fields.Float(required=True)
selling_price = fields.Float("Selling Price", readonly=True)
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 sqm")
garden_orientation = fields.Selection([
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West'),
])
state = fields.Selection(
[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('canceled', 'Canceled'),
],
string="Status",
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
estate.access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
21 changes: 21 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<odoo>

<menuitem id="estate_root_menu" name="Estate"/>

<menuitem id="estate_advertisement_menu"
name="Advertisements"
parent="estate_root_menu"/>
<menuitem id="estate_property_menu"
name="Properties"
parent="estate_advertisement_menu"
action="action_estate_property"/>
<menuitem id="estate_property_list_menu"
name="List"
parent="estate_property_menu"
action="action_estate_property_list_only"/>

<menuitem id="estate_property_form_menu"
name="Form"
parent="estate_property_menu"
action="estate_property_form_action"/>
</odoo>
90 changes: 90 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

<odoo>


<record id="estate_property_list_view" model="ir.ui.view">
<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Properties">
<field name="name"/>
<field name="postcode"/>
</list>
</field>
</record>

<record id="action_estate_property_list_only" model="ir.actions.act_window">
<field name="name">Properties (List)</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list</field>
<field name="view_id" ref="estate_property_list_view"/>
</record>

<record id="estate_property_form_view" model="ir.ui.view">
<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Property">
<sheet>
<h1>
<field name="name"/>
</h1>
<group>
<group>
<field name="postcode"/>
<field name="date_availability"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<field name="garden_orientation"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_form_action" model="ir.actions.act_window">
<field name="name">Property(Form)</field>
<field name="res_model">estate.property</field>
<field name="view_mode">form</field>
<field name="view_id" ref="estate_property_form_view"/>
</record>


<record id="estate_property_search_view" model="ir.ui.view">
<field name="name">estate.property.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search Properties">
<field name="name"/>
<field name="postcode"/>

<filter name="filter_available"
string="Available"
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<separator/>
<filter name="group_by_postcode"
string="Group by Postcode"
context="{'group_by': 'postcode'}"/>

</search>
</field>
</record>




<record id="action_estate_property" model="ir.actions.act_window">
<field name="name">Properties</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>


</odoo>