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': "Real Estate",
'depends': ['base'],
'application': True,
'installable': True,
'author': "Demat",
'license': "AGPL-3",
'data': [
"models/ir.model.access.csv",
"views/estate_property_views.xml",
"views/estate_property_type_views.xml",
"views/menu_estate_property.xml",
"views/list_estate_property.xml",
"views/form_estate_property.xml",
"views/search_estate_property.xml"
]
}
2 changes: 2 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import estate_property
from . import estate_property_type
46 changes: 46 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from odoo import fields, models
import datetime


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Estate property model test description"

name = fields.Char(required=True)
description = fields.Text("Description of the Estate Propert Model")
postcode = fields.Char("Post code")
date_availability = fields.Date(
"Availability date",
default=lambda self: datetime.date.today() + datetime.timedelta(days=90),
copy=False
)
expected_price = fields.Float(required=True)
selling_price = fields.Float(copy=False, readonly=True)
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"),
("west", "West"),
("east", "East")
]
)
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",
)
property_type_id = fields.Many2one("estate.property.type", string="Property Type")
buyer_id = fields.Many2one("res.partner", string="Buyer")
salesperson_id = fields.Many2one("res.users", string="Salesperson")
8 changes: 8 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Test property type description"

name = fields.Char(required=True)
3 changes: 3 additions & 0 deletions estate/models/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
estate_property,estate.property,model_estate_property,base.group_user,1,1,1,1
estate_property_type,estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
8 changes: 8 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo>
<record id="estate_property_type_action" model="ir.actions.act_window">
<field name="name">Test</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>

</odoo>
8 changes: 8 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Test</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

</odoo>
71 changes: 71 additions & 0 deletions estate/views/form_estate_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<odoo>
<record id="estate_property_model_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>
<field name="name"/>
</h1>
<group>

<group>
<field name="property_type_id" string="Property Type"/>
</group>
<group>
<field name="expected_price"/>
</group>
<group>
<field name="postcode"/>
</group>
<group>
<field name="date_availability"/>
</group>
<group>
<field name="selling_price"/>
</group>

</group>
<notebook>
<page string="Description">
<group>
<field string="Description" name="description"/>
</group>
<group>
<field string="Bedrooms" name="bedrooms"/>
</group>
<group>
<field string="Living Area (sqm)" name="living_area"/>
</group>
<group>
<field string="Facades" name="facades"/>
</group>
<group>
<field string="Garage" name="garage"/>
</group>
<group>
<field string="Garden" name="garden"/>
</group>
<group>
<field string="Garden Area (sqm)" name="garden_area"/>
</group>
<group>
<field string="Garden Orientation" name="garden_orientation"/>
</group>

</page>
<page string="Other info">
<group>
<field string="Salesman" name="salesperson_id"/>
</group>
<group>
<field string="Buyer" name="buyer_id"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</odoo>
17 changes: 17 additions & 0 deletions estate/views/list_estate_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<odoo>
<record id="estate_property_model_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" string="Title"/>
<field name="postcode" string="Postcode"/>
<field name="bedrooms" string="Bedrooms"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="expected_price" string="Expected Price"/>
<field name="selling_price" string="Selling Price"/>
<field name="date_availability" string="Available From"/>
</list>
</field>
</record>
</odoo>
10 changes: 10 additions & 0 deletions estate/views/menu_estate_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<odoo>
<menuitem id="estate_test_menu_root" name="Real Estate">
<menuitem id="test_first_level_menu" name="Estate Properties">
<menuitem id="estate_menu_item" name="List view" action="estate_property_action" />
</menuitem>
<menuitem id="settings_top_menu" name="Settings">
<menuitem id="property_type_menu_action" name="Property Types" action="estate_property_type_action"/>
</menuitem>
</menuitem>
</odoo>
25 changes: 25 additions & 0 deletions estate/views/search_estate_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<odoo>
<record id="estate_property_model_search" model="ir.ui.view">
<field name="name">estate_property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Tests">
<field string="Title" name="name"/>
<field string="Postcode" name="postcode"/>
<field string="Expected Price" name="expected_price"/>
<field string="Bedrooms" name="bedrooms"/>
<field string="Living Area" name="living_area"/>
<field string="Facades" name="facades"/>
<separator/>
<filter string="Available" name="available" domain="[('state', 'in', ['new', 'offer_received'])]"/>
<group>
<filter
string="Postcode"
name="postcode"
context="{'group_by':'postcode', 'residual_visible':True}"
/>
</group>
</search>
</field>
</record>
</odoo>