Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

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

No need to declare.

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 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

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

No need to declare.

{
"name": "Real Estate",
"version": "0.1",
"depends": ["base"],
"author": "Madhav Pancholi",
"category": "Real Estate",
"description": """
Manage properties, rentals, and real estate sales.
""",
"installable": True,
"application": True,
"data": [
"security/ir.model.access.csv",
"views/estate_property_view.xml",
"views/estate_property_type_view.xml",
"views/estate_menus.xml",
],
"demo": [],
}
3 changes: 3 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

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

No need to declare here.

from . import estate_property
from . import estate_property_type
54 changes: 54 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

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

No need to declare.

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


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

name = fields.Char(required=True, string="Title")
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(
string="Available From",
copy=False,
default=lambda self: fields.Date.today() + relativedelta(months=3),
)
expected_price = fields.Float(required=True)
selling_price = fields.Float(copy=False, readonly=True)
bedrooms = fields.Integer(default=2)
living_area = fields.Integer(string="Living Area(sqm)")
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection(
selection=[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
]
)
active = fields.Boolean(default=True)
state = fields.Selection(
selection=[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("cancelled", "Cancelled"),
],
default="new",
required=True,
)
salesman_id = fields.Many2one(
"res.users",
string="Salesman",
default=lambda self: self.env.user.id,
)
buyer_id = fields.Many2one("res.partner", string="Buyer", copy=False)
property_type_id = fields.Many2one(
"estate.property.type", string="Property Type", copy=False
)
9 changes: 9 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-

Choose a reason for hiding this comment

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

No need to declare.

from odoo import fields, models


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

name = fields.Char(required=True, string="Type")
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
access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
34 changes: 34 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem
id="estate_property_menu_root"
name="Real Estate"
sequence="5"
/>
<menuitem
id="estate_property_advertisements"
name="Advertisements"
parent="estate.estate_property_menu_root"
sequence="1"
/>
<menuitem
id="estate_property_menu_properties"
name="Properties"
parent="estate.estate_property_advertisements"
action="estate_property_action_menu"
sequence="1"
/>
<menuitem
id="estate_property_menu_settings"
name="Settings"
parent="estate.estate_property_menu_root"
sequence="2"
/>
<menuitem
id="estate_property_menu_property_type"
name="Property Type"
parent="estate.estate_property_menu_settings"
action="estate_property_type_action"
sequence="1"
/>
</odoo>

Choose a reason for hiding this comment

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

Should be one empty line at the end of the file.

41 changes: 41 additions & 0 deletions estate/views/estate_property_type_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_type_view_tree" model="ir.ui.view">
<field name="name">estate.property.type.view.tree</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<list string="Property Type">
<field name="name"/>
</list>
</field>
</record>
<record id="estate_property_type_view_form" model="ir.ui.view">

Choose a reason for hiding this comment

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

Should be one empty line before it.

<field name="name">estate.property.type.view.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="Property Type">
<sheet>
<group>
<group>
<field name="name"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="estate_property_type_view_search" model="ir.ui.view">

Choose a reason for hiding this comment

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

Should be one empty line before it.

<field name="name">estate.property.type.search</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<search string="Property Type">
<field name="name"/>
</search>
</field>
</record>
<record id="estate_property_type_action" model="ir.actions.act_window">

Choose a reason for hiding this comment

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

Should be one empty line before it.

<field name="name">Property Type</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

Choose a reason for hiding this comment

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

Should be one empty line at the end of the file.

86 changes: 86 additions & 0 deletions estate/views/estate_property_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_view_tree" model="ir.ui.view">
<field name="name">estate.property.view.tree</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="date_availability"/>
</list>
</field>
</record>
<record id="estate_property_view_form" model="ir.ui.view">

Choose a reason for hiding this comment

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

Should be one empty line before it.

<field name="name">estate.property.view.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Properties">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1><field name="name" class="oe_inline"/></h1>
</div>
<group>
<group>
<field name="property_type_id"/>
<field name="postcode"/>
<field name="expected_price"/>
</group>
<group>
<field name="date_availability"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page name="description" 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"/>
</group>
</page>
<page name="other_info" string="Other Info">
<group>
<field name="salesman_id"/>
<field name="buyer_id"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="estate_property_view_search" model="ir.ui.view">

Choose a reason for hiding this comment

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

Should be one empty line before it.

<field name="name">estate.property.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Properties">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<separator/>
<filter name="available_properties" domain="[('state','in',('new', 'offer_received'))]"/>
<group expand="1" string="Group By">
<filter string="Postcode" name='postcode' context="{'group_by':'postcode'}"/>
</group>
</search>
</field>
</record>
<record id="estate_property_action_menu" 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>

Choose a reason for hiding this comment

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

Should be one empty line at the end of the file.