Skip to content
3 changes: 3 additions & 0 deletions .vscode/settings.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccary diff.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"
}
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
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",
'version': "0.1.0",
'author': "keman-odoo",
'license': "LGPL-3",
'category': "Tutorials",
'depends': ['base'],
'summary': "manage properties, track buyers offers and handle property sales efficiently",
'sequence': "3",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why sequence = 3?

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



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

name = fields.Char(required=True, default="UNKNOWN")
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(
default=lambda self: fields.Date.today() + relativedelta(months=+3), copy=False)
expected_price = fields.Float(required=True)
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()
active = fields.Boolean(default=True)
garden_orientation = fields.Selection(
[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')
],
string="Garden Orientation"
)
state = fields.Selection(
[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('cancelled', 'Cancelled'),
],
default='new',
copy=False,
required=True,
)
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
14 changes: 14 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<odoo>

<menuitem id="estate_menu_root" name="Real Estate"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccary diff.

<menuitem id="estate_advertisements_menu"
name="Advertisements"
parent="estate_menu_root"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccary diff.

<menuitem id="estate_property_menu_action"
name="Properties"
parent="estate_advertisements_menu"
action="estate_property_action"/>

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

<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>

<record id="view_estate_property_list" 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"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability"/>
</list>
</field>
</record>

<record id="view_estate_property_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="Property">
<sheet>

<h1>
<field name="name"/>
</h1>

<group>
<group>
<field name="postcode"/>
<field name="date_availability"/>
</group>

<group>
<field name="expected_price"/>
<field name="selling_price"/>
</group>
</group>

<notebook>
<page string="Description">

<group>
<field name="description"/>
</group>

<group>
<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>

<record id="view_estate_property_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"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="bedrooms"/>
<field name="living_area"/>

<filter name="available"
string="Available"
domain="['|', ('state','=','new'), ('state','=','offer_received')]"/>

<group>
<filter name="group_by_postcode"
string="Postcode"
context="{'group_by':'postcode'}"/>
</group>

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

</odoo>