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
15 changes: 15 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
'name': "Estate",
'author': "Arthur De Clerck",
'license': "LGPL-3",
'depends': ['base'],
'category': "Real Estate/Brokerage",
'application': True,
'data': [
'security/ir.model.access.csv',
# 'security/security.xml',

'views/estate_menus.xml',
'views/estate_property_views.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
40 changes: 40 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from odoo import fields, models


class EstateProperty(models.Model):
_name = "estate_property"
_description = "Estate property informations"

name = fields.Char(required=True, string="Title")
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False, default=fields.Date.add(fields.Date.today(), months=3), string="Available From")
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()
garden_orientation = fields.Selection(
selection=[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West'),
],
help="Orientation precises where the garden is oriented"
)
state = fields.Selection(
selection=[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('cancelled', 'Cancelled'),
],
required=True,
default='new',
)
active = fields.Boolean(default=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
6 changes: 6 additions & 0 deletions estate/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="groups_privilege_real_estate" model="base.module_category_real_estate_brokerage">
<field name="name">Real Estate</field>
</record>
</odoo>
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"?>
<odoo>
<menuitem id="estate_menu_root" name="Estate">
<menuitem id="estate_advertisements_menu" name="Advertisements">
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
</menuitem>
</menuitem>
</odoo>
86 changes: 86 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_view_tree" 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" width="500px" string="Title"/>
<field name="postcode" width="80px"/>
<field name="bedrooms"/>
<field name="living_area" width="90px"/>
<field name="expected_price" width="100px"/>
<field name="selling_price"/>
<field name="date_availability" width="100px" string="Available From"/>
</list>
</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="Property">
<sheet>
<div class="oe_title">
<h1 class="mb32">
<field name="name" class="mb16"/>
</h1>
<field name="active" invisible="1"/>
</div>
<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">
<div class="col">
<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>
</div>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="estate_property_view_search" model="ir.ui.view">
<field name="name">estate_property.view.search</field>
<field name="model">estate_property</field>
<field name="arch" type="xml">
<search string="Search Properties">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<filter string="Available" name="available" domain="[('state', 'in', ('new', 'offer_received'))]"/>
<filter string="Postcode" name="postcode" context="{'group_by':'postcode', 'residual_visible':True}"/>
</search>
</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>