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
2 changes: 1 addition & 1 deletion awesome_gallery/views/views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<record id="contacts.action_contacts" model="ir.actions.act_window">
<field name="name">Contacts</field>
<field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="view_mode">kanban,list,form,activity</field>
<field name="search_view_id" ref="base.view_res_partner_filter"/>
<field name="context">{'default_is_company': True}</field>
<field name="help" type="html">
Expand Down
2 changes: 2 additions & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models

21 changes: 21 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "estate",
"version": "1.0",
"summary": "Estate management",
"description": "Estate management",
"author": "Odoo S.A.",
"website": "https://www.odoo.com/",
"license": "LGPL-3",
"category": "Uncategorized",
"depends": ["base"],
"installable": True,
"application": True,
"data": [
"security/ir.model.access.csv",
"views/estate_property_views.xml",
"views/estate_property_type_views.xml",
"views/estate_property_tag_views.xml",
"views/estate_menus.xml"
],
}

3 changes: 3 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tag
65 changes: 65 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from odoo import fields, models, api
from datetime import timedelta
Comment on lines +1 to +2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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



class EstateProperty(models.Model):

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

name = fields.Char(string="Title", required=True)
description = fields.Text(string="Description")
postcode = fields.Char(string="Postcode")
date_availability = fields.Date(
string="Available From",
default=lambda self: fields.Date.today() + timedelta(days=90),
copy=False,
)
expected_price = fields.Float(string="Expected Price")
selling_price = fields.Float(
string="Selling Price",
copy=False,
readonly=True,
)
bedrooms = fields.Integer(
string="Bedrooms",
default=2,
)
living_area = fields.Integer(string="Living Area")
facades = fields.Integer(string="Facades")
garden = fields.Boolean(string="Garden")
garage = fields.Boolean(string="Garage")
garden_area = fields.Integer(string="Garden Area")
garden_orientation = fields.Selection(
[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
],
string="Garden Orientation",
)
active = fields.Boolean(default=True)
state = fields.Selection(
[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("cancelled", "Cancelled"),
],
string="State",
required=True,
default="new",
copy=False,
)
property_type_id = fields.Many2one(
"estate.property.type",
string="Property Type"
)
tag_ids = fields.Many2many(
"estate.property.tag",
string="Tags"
)


8 changes: 8 additions & 0 deletions estate/models/estate_property_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyTag(models.Model):
_name = "estate.property.tag"
_description = "Property Tag"

name = fields.Char(required=True)
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 = "Real Estate Property Type"

name = fields.Char(required=True)
5 changes: 5 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tag,estate.property.tag,model_estate_property_tag,,1,1,1,1

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

<!-- Root Menu -->
<menuitem
id="estate_menu_root"
name="Real Estate"
/>

<!-- Properties Menu -->
<menuitem
id="estate_advertisements_menu"
name="Advertisements"
parent="estate_menu_root"
/>

<!-- Properties Action Menu -->
<menuitem
id="estate_property_menu"
name="Properties"
parent="estate_advertisements_menu"
action="estate_property_action"
/>
<!--Tags Menu-->
<menuitem
id="menu_property_type"
name="Property Types"
parent="estate_menu_root"
action="action_property_type"
sequence="20"
/>
<menuitem
id="estate_property_tag_menu_action"
name="Property Tags"
parent="estate_property_menu"
action="estate_property_tag_action"
/>

</odoo>

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

<record id="estate_property_tag_action" model="ir.actions.act_window">
<field name="name">Property Tags</field>
<field name="res_model">estate.property.tag</field>
<field name="view_mode">list,form</field>
</record>

<record id="estate_property_tag_view_list" model="ir.ui.view">
<field name="name">estate.property.tag.list</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
</list>
</field>
</record>

<record id="estate_property_tag_view_form" model="ir.ui.view">
<field name="name">estate.property.tag.form</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>

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

<!-- List View -->
<record id="view_property_type_list" model="ir.ui.view">
<field name="name">estate.property.type.list</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>

<!-- Form View -->
<record id="view_property_type_form" model="ir.ui.view">
<field name="name">estate.property.type.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>

<!-- Action -->
<record id="action_property_type" model="ir.actions.act_window">
<field name="name">Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>


</odoo>

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

<!-- list View -->
<record id="view_estate_property_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="property_type_id"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="bedrooms"/>
<field name="active"/>
<field name="tag_ids" widget="many2many_tags"/>
</list>
</field>
</record>

<!-- Form View -->
<record id="view_estate_property_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"
edit="0">
<sheet>
<group>
<group>
<field name="name"/>
<field name="postcode"/>
<field name="date_availability"/>
<field name="property_type_id"/>
<field name="tag_ids" widget="many2many_tags"/>
<field name="expected_price"/>
<field name="selling_price"/>
</group>
<group>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This field is not define in the model.

<field name="garden_area"/>
<field name="garden_orientation"/>
<field name="active"/>
</group>
</group>
<notebook>
<page string="Description">
<field name="description"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!-- Search View -->
<record id="view_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="Search Properties">

<!-- Search fields -->
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>

<!-- Filters -->
<filter
name="available"
string="Available"
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"
/>

<!-- Group By -->
<filter
name="group_by_postcode"
string="Postcode"
context="{'group_by': 'postcode'}"
/>

</search>
</field>
</record>

<!-- Action -->
<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>