Skip to content

Commit 51d5d60

Browse files
committed
[IMP] real_estate: update fields and menus in real estate
Set default values for fields, added new field attributes, and created menus for accessing default list and form views in Real Estate module
1 parent cb8613b commit 51d5d60

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

estate/__manifest__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
'name': 'Real Estate',
33
'depends': ['base'],
4+
'data': ['security/ir.model.access.csv',
5+
'views/estate_property_views.xml',
6+
'views/estate_menus.xml'
7+
]
48
}

estate/models/estate_property.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
from odoo import models,fields
1+
from odoo import models, fields
2+
from dateutil.relativedelta import relativedelta
23

34
class estateproperty(models.Model):
45
_name = "estate.property"
56
_description = "Real Estate Property"
67

7-
name = fields.Char(required='True')
8+
name = fields.Char(required=True)
89
description = fields.Text(string="Description")
910
postcode = fields.Char(string="Postcode")
10-
date_availability = fields.Date(string="Available From")
11+
date_availability = fields.Date(string="Availability Date", default=fields.Date.today()+relativedelta(months=3))
1112
expected_price = fields.Float(string="Expected Price", required=True)
1213
selling_price = fields.Float(string="Selling Price", readonly=True)
1314
bedrooms = fields.Integer(string="Bedrooms", default=2)
@@ -17,7 +18,25 @@ class estateproperty(models.Model):
1718
garden = fields.Boolean(string="Garden")
1819
garden_area = fields.Integer(string="Garden Area (sqm)")
1920
garden_orientation = fields.Selection(
20-
selection=[('north', 'North'),('south', 'South'),('east', 'East'),('west', 'West')],
21-
string="Garden Orientation"
21+
selection=[
22+
("north", "North"),
23+
("south", "South"),
24+
("east", "East"),
25+
("west", "West"),
26+
],
27+
string="Garden Orientation",
2228
)
23-
active = fields.Boolean(string="Active", default=True)
29+
state = fields.Selection(
30+
[
31+
("new", "New"),
32+
("offer_received", "Offer Received"),
33+
("offer_accepted", "Offer Accepted"),
34+
("sold", "Sold"),
35+
("cancelled", "Cancelled"),
36+
],
37+
string="Status",
38+
required=True,
39+
copy=False,
40+
default="new",
41+
)
42+
active = fields.Boolean(string="Active", default=True)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1

estate/views/estate_menus.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<odoo>
2+
<menuitem id="test_menu_root" name="real_estate">
3+
<menuitem id="menu_estate_advertisements" name="Advertisements">
4+
<menuitem id="menu_estate_property_action" action="action_estate_property" />
5+
</menuitem>
6+
</menuitem>
7+
</odoo>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<odoo>
2+
<record id="action_estate_property" model="ir.actions.act_window">
3+
<field name="name">Properties</field>
4+
<field name="res_model">estate.property</field>
5+
<field name="view_mode">list,form</field>
6+
<field name="help" type="html">
7+
<p class="o_view_nocontent_smiling_face">
8+
Create a new property
9+
</p>
10+
</field>
11+
</record>
12+
</odoo>

0 commit comments

Comments
 (0)