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
11 changes: 11 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
'name': 'Estate',
'depends': ['base'],
'application': True,

'data': [
'security/ir.model.access.csv',
'view/estate_property_views.xml',
'view/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
50 changes: 50 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from odoo import fields, models
from datetime import timedelta


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

name = fields.Char(string="Title", required=True)
description = fields.Text(string="Description")
postcode = fields.Char(string="Postcode")

expected_price = fields.Float(string="Expected Price", required=True)
selling_price = fields.Float(string="Selling Price", copy=False, readonly=True)

expected_date = fields.Date(
string="Expected Date",
required=True,
copy=False,
default=(fields.Date.today() + timedelta(days=90)),
)

bedroom = fields.Integer(string="Number of Bedroom", default=2)
living_area = fields.Integer(string="Living area (square metter)")
facades = fields.Integer(string="Number of facades")
garage = fields.Boolean(string="Have a garage?")
garden = fields.Boolean(string="Have a garden?")
garden_area = fields.Integer(string="Garden area (square metter)")
garden_orientation = fields.Selection(
string="Garden's orientation",
selection=[
("north", "North"),
("sud", "Sud"),
("east", " East"),
("west", "West"),
],
)
state = fields.Selection(
string="Estate's state",
selection=[
("new", "New"),
("offer_recieved", "Offer Received"),
("offer_accepted", " Offer Accepted"),
("sold", "Sold"),
("cancelled", "Cancelled"),
],
default="new",
)

active = fields.Boolean(default=False)
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_model,access_estate_model,model_estate_property,base.group_user,1,1,1,1
10 changes: 10 additions & 0 deletions estate/view/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<menuitem id="estate_menu_root" name="Estate Root">
<menuitem id="estate_first_level_menu" name="First Level">
<menuitem id="estate_model_menu_action" action="estate_property_action"/>
</menuitem>
</menuitem>

</odoo>
91 changes: 91 additions & 0 deletions estate/view/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Estate 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 string="Properties">
<field name="name"/>
<field name="postcode"/>
<field name="bedroom"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="expected_date"/>
</list>
</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 string="New Estate">
<sheet>
<h1>
<field name="name" placeholder="e.g New House"/>
</h1>
<group>
<group>
<field name="postcode"/>
<field name="expected_date" string="Available From"/>
</group>
<group>
<field name="expected_price"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page string="Description">
<field name="description"/>

<group>
<group>
<field name="bedroom"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="facades" string="Facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area" string="Garden Area (sqm)"/>
<field name="garden_orientation"/>
<field name="state"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!-- Search -->
<record id="estate_property_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="Estate Type">
<field name="name" string="Estate" />
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedroom"/>
<field name="living_area"/>
<field name="facades"/>
<separator/>
<filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_recieved')]"/>
<group>
<filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/>
</group>
</search>
</field>
</record>

</odoo>