Skip to content

Commit

Permalink
[ADD] estate : Added new Module
Browse files Browse the repository at this point in the history
Day 1 :
Chapter 2  : Created Folder Structure for Real-estate module
Chapter 3  : Created estate_properties model with all the basic fields
[IMP] real-estate: security , ui and search filters

Day 2 :
Chapter 4: Understood Data files(CSV) and gave access-rights
Chapter 5: Understood Data files(XML) and Implemented actions , menus and fields
Chapter 6: Understood Basic views and Implemented List , Form and Search filters
  • Loading branch information
nmak-odoo committed Feb 6, 2025
1 parent 4c650f3 commit 03625d0
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 0 deletions.
Empty file added estate/__init__.py
Empty file.
Empty file added estate/__manifest__.py
Empty file.
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
48 changes: 48 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from odoo import fields, models
from dateutil.relativedelta import relativedelta


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Properties involved in estate"

name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(
"Availability Date",
copy=False,
default=fields.Date.add(fields.Date.today(), 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()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Float()
garden_orientation = fields.Selection(
selection=[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
]
)

# reserved fields
active = fields.Boolean(default=False)
state = fields.Selection(
[
("new", "New"),
("offer_recieved", "Offer Recieved"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("cancelled", "Cancelled"),
],
string="Invoice Status",
default="new",
required=True,
copy=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_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
1 change: 1 addition & 0 deletions estate/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello
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_property_root" name="Real Estate">
<menuitem id="test_first_level_menu" name="Properties">
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
</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 @@
<?xml version="1.0"?>
<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 string="Properties">
<field name="name" />
<field name="expected_price" />
<field name="selling_price" />
<field name="state" />
<field name="postcode" />
<field name="date_availability" />
<field name="active" />
</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">
<sheet>
<group>
<field name="name" />
<field name="expected_price" />
<field name="selling_price" />
<field name="state" />
<field name="postcode" />
<field name="date_availability" />
<field name="active" />
</group>
<notebook>
<page string="Description">
<group>
<field name="description" />
<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>
</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">
<field name="name" />
<filter string="Archived" name="inactive"
domain="[('active', '=', False)]" />
<filter string="Available" name="aadfae"
domain="[('state', 'in', ['New', 'Offer Received'])]" />
<filter name="fadsfef"
string="Postcode"
context="{'group_by': 'postcode'}" />
</search>
</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>

0 comments on commit 03625d0

Please sign in to comment.