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
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
23 changes: 23 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
'name': "Estate",
'version': '0.1',
'summary': "Real Estate Advertisement",
'description': """
This module allows you to manage real estate advertisements, including
properties, agents, and customer inquiries.
""",
'author': "aykhu",
'license': 'LGPL-3',
'website': "https://www.odoo.com/app/estate",
'category': 'Tutorials',
'application': True,
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_tags_views.xml',
'views/estate_property_offer_views.xml',
'views/estate_menus.xml',
],
}
4 changes: 4 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tags
from . import estate_property_offer
52 changes: 52 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from odoo import fields, models
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 = 'Estate Property'

name = fields.Char(string='Title', required=True, default='Unknown')
description = fields.Text(string='Description')
postcode = fields.Char(string='Postal Code')
last_seen = fields.Datetime(
string="Last Seen", default=fields.Datetime.now)
date_availability = fields.Date(
string='Available From', copy=False, default=fields.Date.today() + relativedelta(months=+3)
)
expected_price = fields.Float(string='Expected Price', required=True)
selling_price = fields.Float(
string='Selling Price', readonly=True, copy=False)
living_area = fields.Float(string='Area (sq m)')
bedrooms = fields.Integer(string='Bedrooms', default=2)
facades = fields.Integer(string='Facades')
has_garage = fields.Boolean(string="Has Garage ?")
has_garden = fields.Boolean(string="Has Garden ?")
garden_area = fields.Integer(string="Garden Area (sq m)")
active = fields.Boolean(string="Is Active ?", default=True)
garden_orientation = fields.Selection(
string="Garden Orientation",
selection=[('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')],
Comment on lines +29 to +32

Choose a reason for hiding this comment

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

indentation issue.

)
state = fields.Selection(
string="Status",
selection=[("New", "New"),
("Offer Received", "Offer Received"),
("Offer Accepted", "Offer Accepted"),
("Sold", "Sold"),
("Cancelled", "Cancelled")],
Comment on lines +36 to +40

Choose a reason for hiding this comment

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

Indentation issue.

required=True, default="New", copy=False
)
property_type_id = fields.Many2one(
"estate.property.type", ondelete='Cascade', string="Property Type"
)
salesperson_id = fields.Many2one(
"res.users", string="Sales Person", default=lambda self: self.env.user
)
buyer_id = fields.Many2one("res.partner", string="Buyer", copy=False)
property_tags_ids = fields.Many2many(
"estate.property.tags", string="Property Tags")
offer_ids = fields.One2many("estate.property.offer", "property_id")
18 changes: 18 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo import fields, models


class EstatePropertyOffer(models.Model):
_name = "estate.property.offer"
_description = "Estate Property Offer"

price = fields.Float(string="Offer Price")
status = fields.Selection(
selection=[
("accepted", "Accepted"),
("refused", "Refused"),
],
string="Status",
copy=False,
)
partner_id = fields.Many2one("res.partner", required=True)
property_id = fields.Many2one("estate.property", required=True)
8 changes: 8 additions & 0 deletions estate/models/estate_property_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyTags(models.Model):
_name = "estate.property.tags"
_description = "Estate Property Tag"

name = fields.Char(string="Name", required=True)
8 changes: 8 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


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

name = fields.Char(string="Name", required=True)
5 changes: 5 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1
estate.access_estate_property_tags,access_estate_property_tags,estate.model_estate_property_tags,base.group_user,1,1,1,1
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1
12 changes: 12 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<menuitem id = "estate_menu_root" name = "Real Estate">
<menuitem id = "estate_menu_advertisements" name = "Advertisements">
<menuitem id = "estate_menu_advertisements_properties" name = "Properties" action="estate_property_action"/>
</menuitem>
<menuitem id = "estate_menu_settings" name="Settings">
<menuitem id = "estate_menu_settings_types" name = "Property Types" action="estate.estate_property_types_action"/>
<menuitem id = "estate_menu_settings_tags" name="Property Tags" action="estate_property_tags_action"/>
</menuitem>
</menuitem>
</odoo>
30 changes: 30 additions & 0 deletions estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- List View-->
<record id="estate_property_offer_view_list" model="ir.ui.view">
<field name="name">estate.property.offer.list</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<list>
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</list>
</field>
</record>

<!-- Form View -->
<record id="estate_property_offer_view_form" model="ir.ui.view">
<field name="name">estate.property.offer.form</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<form>
<group>
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</group>
</form>
</field>
</record>
</odoo>
8 changes: 8 additions & 0 deletions estate/views/estate_property_tags_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_tags_action" model="ir.actions.act_window">
<field name="name">estate_property_tags</field>
<field name="res_model">estate.property.tags</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
8 changes: 8 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_types_action" model="ir.actions.act_window">
<field name="name">Estate Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
95 changes: 95 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Test action</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

<!-- List View -->
<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" width="200"/>
<field name="postcode" width="80"/>
<field name="property_type_id"/>
<field name="property_tags_ids" widget="many2many_tags" width="300"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability"/>
</list>
</field>
</record>

<!-- Search View-->
<record id="estate_property_view_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="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="property_type_id"/>
<filter name="state" string="Status" domain="['|', ('state', '=', 'New'), ('state', '=', 'Offer Received')]"/>
<filter name="groupby_postcode" string="Postcode" context="{'group_by': 'postcode'}"/>
</search>
</field>
</record>

<!-- Form View -->
<record id="estate_property_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="property_tags_ids" widget="many2many_tags"/>
<field name="postcode"/>
<field name="date_availability"/>
<field name="property_type_id"/>
</group>
<group>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="buyer_id"/>
<field name="salesperson_id"/>
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="has_garage"/>
</group>
<group>
<field name="has_garden"/>
<field name="garden_area" invisible="not has_garden"/>
<field name="garden_orientation" invisible="not has_garden"/>
</group>
</page>
<page string="Offers">
<field name="offer_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</odoo>