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 estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
'name': 'RealEstate',
'version': '1.0',
'category': 'Real Estate/Brokerage',
'summary': 'A module to manage real estate advertisements and property offers',
'description': """A simple module to manage real estate ads.List your properties, track details like bedrooms and garden,let buyers make offers, and accept or reject them.""",
'author': 'Pranjali Sangavekar(prsan)',
'license': 'LGPL-3',
'depends': ['base'],
'application': True,
'installable': True,

Choose a reason for hiding this comment

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

What is the use of 'installable': True,?

'data': [
'security/security.xml',
'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
32 changes: 32 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from dateutil.relativedelta import relativedelta
from odoo import models, fields
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 Estate_Property(models.Model):
_name = "estate.property" #table name in DB = estate_property

Choose a reason for hiding this comment

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

Writing a comment is good. But we can write a comment only when it is necessary, like a complex computation, etc.

_description = "Real estate system"

name = fields.Char(string="Property Name", required=True)
description = fields.Text()
postcode = fields.Char(string="Postal Code")
date_availability = fields.Date(copy=False, default=lambda self: fields.Date.today() + relativedelta(months=3))
expected_price = fields.Float(string="Expected Price", 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()
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'),
],
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_manager,estate.property manager,model_estate_property,estate.estate_group_manager,1,1,1,1
access_estate_property_user,estate.property agent,model_estate_property,estate.estate_group_user,1,1,0,0

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.

23 changes: 23 additions & 0 deletions estate/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="res.groups.privilege" id="groups_privilege_real_estate">
<field name="name">Real Estate</field>
<field name="category_id" ref="base.module_category_real_estate_brokerage"/>
</record>

<record id="estate_group_user" model="res.groups">
<field name="name">Agent</field>
<field name="privilege_id" ref="groups_privilege_real_estate"/>
</record>

<record id="estate_group_manager" model="res.groups">
<field name="name">Manager</field>
<field name="privilege_id" ref="groups_privilege_real_estate"/>
<field name="implied_ids" eval="[Command.link(ref('estate_group_user'))]"/>
</record>
<record id="base.user_admin" model="res.users">
<field name="group_ids" eval="[Command.link(ref('estate_group_manager'))]"/>
</record>
</data>
</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.

8 changes: 8 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_first_level_menu" name="Advertisements">
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
</menuitem>
</menuitem>
</odoo>
61 changes: 61 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="esatae_porpoerty_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>
<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"/>
<field name="bedrooms"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area" string="Garden Area (sqm)"/>
<field name="garden_orientation"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="estate_property_view_list" model="ir.ui.view">
<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list>
<field name="name" string="Title"/>
<field name="postcode" string="Postcode"/>
<field name="bedrooms"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability" string="Available From"/>
</list>
</field>
</record>
<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>