Skip to content

Commit 1b882f2

Browse files
committed
[ADD] (Chapter : 5) estate - added property menus, action, and views
- Added Real Estate menu structure and link property action - Created window action for estate.property - Load property views and menu XML in manifest
1 parent f265d33 commit 1b882f2

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

estate/__manifest__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
'license': 'LGPL-3',
88
'description': 'Real estate purchase & sales',
99
'data': [
10+
'views/estate_property_views.xml',
11+
'views/estate_property_menu.xml',
1012
'security/ir.model.access.csv'
1113
],
1214
'application': True,

estate/models/estate_property.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from odoo import models, fields
2-
2+
from dateutil.relativedelta import relativedelta
33

44
class EstateProperty(models.Model):
55
_name = "estate.property"
@@ -8,10 +8,13 @@ class EstateProperty(models.Model):
88
name = fields.Char(required=True)
99
description = fields.Text()
1010
pincode = fields.Char()
11-
date_availability = fields.Date()
11+
date_availability = fields.Date(
12+
copy=False,
13+
default=lambda self: fields.Date.context_today(self) + relativedelta(months=3),
14+
)
1215
expected_price = fields.Float(required=True)
1316
selling_price = fields.Float()
14-
bedrooms = fields.Integer(required=True)
17+
bedrooms = fields.Integer(default=2)
1518
living_area = fields.Integer()
1619
facades = fields.Integer()
1720
garage = fields.Boolean()
@@ -23,3 +26,16 @@ class EstateProperty(models.Model):
2326
('east', 'East'),
2427
('west', 'West'),
2528
])
29+
state = fields.Selection(
30+
selection=[
31+
("new", "New"),
32+
("offer_received", "Offer Received"),
33+
("offer_accepted", "Offer Accepted"),
34+
("sold", "Sold"),
35+
("cancelled", "Cancelled"),
36+
],
37+
string="Status",
38+
default="new",
39+
)
40+
active = fields.Boolean(default=False)
41+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<odoo>
3+
<menuitem
4+
id="estate_property_menu_root"
5+
name="Real Estate"
6+
/>
7+
<menuitem
8+
id="estate_property_menu_advertisement"
9+
name="Advertisement"
10+
parent="estate_property_menu_root"
11+
/>
12+
<menuitem
13+
id="estate_property_menu_type"
14+
name="Properties"
15+
parent="estate_property_menu_advertisement"
16+
action="main_action_estate"
17+
/>
18+
</odoo>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<odoo>
3+
<record id="main_action_estate" model="ir.actions.act_window">
4+
<field name="name">Estate Property</field>
5+
<field name="res_model">estate.property</field>
6+
<field name="view_mode">list,form</field>
7+
<field name="help" type="html">
8+
<p class="o_view_nocontent_smiling_face">
9+
Create your Properties here !
10+
</p>
11+
</field>
12+
</record>
13+
</odoo>

0 commit comments

Comments
 (0)