Skip to content

Commit 93702f2

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 93702f2

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from odoo import models, fields
2+
from dateutil.relativedelta import relativedelta
23

34

45
class EstateProperty(models.Model):
@@ -8,10 +9,13 @@ class EstateProperty(models.Model):
89
name = fields.Char(required=True)
910
description = fields.Text()
1011
pincode = fields.Char()
11-
date_availability = fields.Date()
12+
date_availability = fields.Date(
13+
copy=False,
14+
default=lambda self: fields.Date.context_today(self) + relativedelta(months=3),
15+
)
1216
expected_price = fields.Float(required=True)
1317
selling_price = fields.Float()
14-
bedrooms = fields.Integer(required=True)
18+
bedrooms = fields.Integer(default=2)
1519
living_area = fields.Integer()
1620
facades = fields.Integer()
1721
garage = fields.Boolean()
@@ -23,3 +27,15 @@ class EstateProperty(models.Model):
2327
('east', 'East'),
2428
('west', 'West'),
2529
])
30+
state = fields.Selection(
31+
selection=[
32+
("new", "New"),
33+
("offer_received", "Offer Received"),
34+
("offer_accepted", "Offer Accepted"),
35+
("sold", "Sold"),
36+
("cancelled", "Cancelled"),
37+
],
38+
string="Status",
39+
default="new",
40+
)
41+
active = fields.Boolean(default=False)
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)