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
17 changes: 17 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
'name': 'Estate',
'depends': [
'base_setup',
],
'installable': True,
'application': True,
'data': [
'views/estate_property_offer_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_views.xml',
'views/estate_menus.xml',

'security/ir.model.access.csv',
]
}
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_type
from . import estate_property_tag
from . import estate_property_offer
from . import estate_property
41 changes: 41 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from odoo import fields, models
from datetime import timedelta

def default_availability_date(recordset):
return fields.Datetime.today() + timedelta(days=90)

class EstateProperty(models.Model):
_name = "estate.property"
_description = "Real Estate Advertisement module"

name = fields.Char('Name', required=True)
description = fields.Text('Description')
postcode = fields.Char('Postcode')
date_availability = fields.Date('Date availability', copy=False, default=default_availability_date)
expected_price = fields.Float('Expected price', required=True)
selling_price = fields.Float('Selling price', readonly=True, copy=False)
bedrooms = fields.Integer('Bedrooms', default=2)
living_area = fields.Integer('Living Area')
facades = fields.Integer('Facades')
garage = fields.Boolean('Garage')
garden = fields.Boolean('Garden')
garden_area = fields.Integer('Garden Area')
garden_orientation = fields.Selection(selection=[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')
], string='Garden orientation')
active = fields.Boolean('Active' ,default=True)
state = fields.Selection(selection=[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('cancelled', 'Cancelled')
], string="State", default='new', required=True, copy=False)
property_type_id = fields.Many2one('estate.property.type', string="Property type")
property_buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False)
property_salesperson_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user)
property_tag_ids = fields.Many2many('estate.property.tag', string="Property tags")
property_offer_ids = fields.One2many('estate.property.offer', 'property_id', string='Offers')
13 changes: 13 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from odoo import fields, models

class EstatePropertyOffer(models.Model):
_name = "estate.property.offer"
_description = "A property offer"

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

class EstatePropertyTag(models.Model):
_name = "estate.property.tag"
_description = "A property tag"

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

class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "A property type is, for example, a house or an apartment. It is a standard business need to categorize properties according to their type, especially to refine filtering."

name = fields.Char('Property type', 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
access_real_estate_platform,estate_property,model_estate_property,base.group_user,1,1,1,1
access_real_estate_type,estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
access_real_estate_tag,estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1
access_real_estate_offer,estate_property_offer,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"?>
<odoo>
<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_advertisements" name="Advertisements">
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
</menuitem>
<menuitem id="estate_settings" name="Settings">
<menuitem id="estate_property_type_menu_action" action="estate_property_type_action"/>
<menuitem id="estate_property_tag_menu_action" action="estate_property_tag_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"?>
<odoo>
<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 string="Estate Property Offer">
<sheet>
<group>
<field name="price"/>
<field name="property_buyer_id"/>
<field name="status"/>
</group>
</sheet>
</form>
</field>
</record>

<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 string="Estate property offer">
<field name="price"/>
<field name="property_buyer_id" string="Partner"/>
<field name="status"/>
</list>
</field>
</record>
</odoo>
22 changes: 22 additions & 0 deletions estate/views/estate_property_tag_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_tag_view_form" model="ir.ui.view">
<field name="name">estate.property.tag.form</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<form string="Estate Property Type">
<sheet>
<h1><group>
<field name="name" string="Tag"/>
</group></h1>
</sheet>
</form>
</field>
</record>

<record id="estate_property_tag_action" model="ir.actions.act_window">
<field name="name">Property Tags</field>
<field name="res_model">estate.property.tag</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
22 changes: 22 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_type_view_form" model="ir.ui.view">
<field name="name">estate.property.type.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="Estate Property Type">
<sheet>
<h1><group>
<field name="name" string="Type"/>
</group></h1>
</sheet>
</form>
</field>
</record>

<record id="estate_property_type_action" model="ir.actions.act_window">
<field name="name">Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
101 changes: 101 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0"?>
<odoo>
<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 string="Search...">
<field name="name" string="Title"/>
<field name="property_type_id"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="facades"/>
<filter string="Available" name="filter_available" domain="['|',
('state', '=', 'new'),
('state', '=', 'offer_received')]"/>
<filter string="Postcode" name="groupby_postcode" context="{'group_by': 'postcode'}"/>
</search>
</field>
</record>

<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 string="Estate Property">
<sheet>
<h1><group>
<field name="name" string="Title"/>
</group></h1>

<group>
<field name="property_tag_ids" widget="many2many_tags"/>
</group>

<group>
<group>
<field name="property_type_id"/>
<field name="postcode"/>
<field name="date_availability" string="Available From"/>
</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"/>
<field name="garden_orientation"/>
<field name="state"/>
</group>
</page>
<page string="Offers">
<field name="property_offer_ids"/>
</page>
<page string="Other Info">
<group>
<field name="property_salesperson_id" string="Salesman"/>
<field name="property_buyer_id"/>
</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 string="Estate property">
<field name="name" string="Title"/>
<field name="property_type_id" string="Type"/>
<field name="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>