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": "estate",
"website": "",
"category": "Tutorials",
"version": "0.1",
"application": True,
"installable": True,
"depends": ["base"],
"data": [
"security/security.xml",
"security/ir.model.access.csv",
"views/estate_property_views.xml",
"views/estate_menus.xml",
],
"assets": {},
"author": "Odoo S.A.",
"license": "LGPL-3",
}
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
44 changes: 44 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from odoo import fields, models
from dateutil.relativedelta import relativedelta
from datetime import datetime


class EstateProperty(models.Model):
_name = "estate_property"
_description = "Estate Property"
name = fields.Char("Title", required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(
copy=False, default=datetime.now() + relativedelta(months=3)
)
expected_price = fields.Float(required=True)
selling_price = fields.Float(readonly=True, copy=False)
bedrooms = fields.Integer(default=2)
living_area = fields.Integer("Living Area (sqm)")
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection(
string="Orientation",
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"),
],
default="new",
required=True,
copy=False,
)
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,access_estate_property,model_estate_property,base.group_user,1,1,1,1
access_estate_property_readonly,access_estate_property_readonly,model_estate_property,group_readonly_user,1,0,0,0
10 changes: 10 additions & 0 deletions estate/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<odoo>
<data>
<record id="group_all_rights_user" model="res.groups">
<field name="name">Complete User</field>
</record>
<record id="group_readonly_user" model="res.groups">
<field name="name">Readonly User</field>
</record>
</data>
</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 Property">
<menuitem id="estate_first_level_menu" name="Advertisements">
<menuitem id="estate_second_level_menu" action="estate_property_action" />
</menuitem>
</menuitem>
</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_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" />
<field name="postcode" />
<field name="bedrooms" />
<field name="living_area" />
<field name="expected_price" />
<field name="selling_price" />
<field name="date_availability" />
</list>
</field>
</record>

<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" string="Title" />
<field name="postcode" />
<field name="expected_price" />
<field name="bedrooms" />
<field name="living_area" />
<field name="facades" />
<filter string="Available Properties" name="available_properties"
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" />
<filter name="group_by_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="Test">
<sheet>
<h1>
<field name="name" />
</h1>
<group>
<group>
<field name="postcode" string="Postcode" />
</group>
<group>
<field name="expected_price" string="Expected Price" />
</group>

</group>
<group>
<group>
<field name="date_availability" string="Available From" />
</group>
<group>
<field name="selling_price" string="Selling Price" />
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description" string="Description" />
</group>
<group>
<field name="bedrooms" string="Bedrooms" />
</group>
<group>
<field name="living_area" string="Living Area (sqm)" />
</group>
<group>
<field name="facades" string="Facades" />
</group>
<group>
<field name="garage" string="Garage" />
</group>
<group>
<field name="garden" string="Garden" />
</group>
<group>
<field name="garden_area" string="Garden Area (sqm)" />
</group>
<group>
<field name="garden_orientation" string="Garden Orientation" />
</group>
<field name="state" />
</page>
</notebook>
</sheet>
</form>
</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>