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
9 changes: 9 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
'name': 'Real Estate',
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/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
45 changes: 45 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from odoo import models, fields
from dateutil.relativedelta import relativedelta


class estateproperty(models.Model):

Choose a reason for hiding this comment

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

Class name should be in camel case 'EstateProperty`.

_name = "estate.property"
_description = "Real Estate Property"

name = fields.Char(required=True)
description = fields.Text("Description")
postcode = fields.Char("Postcode")
date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3))

Choose a reason for hiding this comment

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

Suggested change
date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3))
date_availability = fields.Date("Availability Date", default=fields.Date.today() + relativedelta(months=3))

expected_price = fields.Float("Expected Price", required=True)
selling_price = fields.Float("Selling Price", readonly=True)
bedrooms = fields.Integer("Bedrooms", default=2)
living_area = fields.Integer("Living Area (sqm)")
facades = fields.Integer("Facades")
garage = fields.Boolean("Garage")
garden = fields.Boolean("Garden")
garden_area = fields.Integer("Garden Area (sqm)")
Comment on lines +10 to +20

Choose a reason for hiding this comment

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

Please adapt these changes that were suggested to you earlier. You don't have to write a string if it's the same as the technical name.
#1013 (comment)

garden_orientation = fields.Selection(
selection=[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
],
string="Garden Orientation",
)
state = fields.Selection(
[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("cancelled", "Cancelled"),
],
string="Status",
required=True,
copy=False,
default="new",
)
active = fields.Boolean(string="Active", default=True)


Comment on lines +44 to +45

Choose a reason for hiding this comment

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

One empty line is sufficient.

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
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
7 changes: 7 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<odoo>
<menuitem id="test_menu_root" name="real_estate">
<menuitem id="menu_estate_advertisements" name="Advertisements">
<menuitem id="menu_estate_property_action" action="action_estate_property" />
</menuitem>
</menuitem>
</odoo>
80 changes: 80 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<odoo>
<record id="action_estate_property" model="ir.actions.act_window">
<field name="name">Properties</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new property
</p>
</field>
</record>

<record id="estate_property_view_list" model="ir.ui.view">
<field name="name">estate.property.view.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="lists">
<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="view_estate_property_view_form" model="ir.ui.view">
<field name="name">estate.property.view.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="form">
<sheet>
<group>
<group>
<field name="name" />
<field name="postcode" />
<field name="date_availability" />
</group>
<group>
<field name="expected_price" />
<field name="selling_price" />
<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>
</group>
<notebook>
<page string="Discription">
<field name="description"></field>
</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">
<field name="name" />
<field name="postcode" />
<field name="expected_price" />
<filter
string="Available"
name="available_properties"
domain="['|', ('state', '=', 'New'), ('state', '=', 'Offer Received')]" />
<filter string="Postcode" name="group_by_postcode"
context="{'group_by': 'postcode'}" />
</search>
</field>
</record>
</odoo>