Skip to content
Draft
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

20 changes: 20 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{

"name": "real estate",
"version": "1.0",
"summary": "Estate management",
"description": "Estate management",
"author": "Odoo S.A.",
"website": "https://www.odoo.com/",
"category": "Uncategorized",
"depends": ["base"],
"data":[
"security/ir.model.access.csv",
"views/estate_property_views.xml",
"views/estate_menus.xml"
],
"license":"LGPL-3",
"application": True,
"installable":True
}

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

class EstateProperty(models.Model):
_name = "estate.property"
_description = "Real Estate Property"
name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(
default=lambda self: #without lambda date would be fixed permanently
fields.Date.today() + relativedelta(months=3))
expected_price = fields.Float()
selling_price = fields.Float(readonly=True,copy=False)
bedrooms = fields.Integer(default=2)
living_area = fields.Integer()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection([
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West'),
])
active = fields.Boolean(default=True)
state = fields.Selection([
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('canceled', 'Canceled'),
],
required=True,
copy=False,
default='new'
)


3 changes: 3 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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

23 changes: 23 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<odoo>
<!-- Main App Menu -->
<menuitem
id="estate_menu_root"
name="Real Estate"
/>
<!--First Level Menu-->
<menuitem
id="estate_property_menu"
name="Advertisement"
parent="estate_menu_root"
/>
<!--Action Menu-->
<menuitem
id="estate_property_action_menu"
name="Property List"
parent="estate_property_menu"
action="estate_property_action"
/>


</odoo>

94 changes: 94 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<odoo>

<!--List View-->
<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" delete="False">
<field name="name"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability"/>
</list>
</field>
</record>

<!--Form View-->
<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="Properties">
<sheet>
<div>
<h1><field name="name"/></h1>
</div>
<group>
<group>
<field name="postcode"/>
<field name="expected_price"/>
</group>
<group>
<field name="date_availability"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<field name="garden_orientation"/>
<field name="active"/>
<field name="state"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!--Search View-->
<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>
<field name="name" string="xyz"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter string="Available"
name="state"
domain="['|',('state','=','new'),('state','=','offer_received')]"/>
<filter string="Postcode"
name="postcode"
context="{'group_by':'postcode'}"/>

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

<!--ACTION-->
<record id="estate_property_action" 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>