Skip to content

Commit 25213fe

Browse files
committed
[ADD] estate: added menus options and new fields
. Add root, first-level, and action menus for estate properties. . Create list and form views for property records. . Make selling price read-only and exclude it and availability date from duplicates. . Set default bedrooms to 2 and availability date to 3 months ahead. . Add active field (default True) and state field with key property statuses.
1 parent ae10966 commit 25213fe

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed

estate/__manifest__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
'installable': True,
55
'category': 'Real Estate/Brokerage',
66
'data': [
7-
'security/ir.model.access.csv'
7+
'security/ir.model.access.csv',
8+
'views/estate_property_views.xml',
9+
'views/estate_menus.xml'
810
]
911
}

estate/models/estate_property.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from odoo import models, fields
2+
from datetime import timedelta
23

34
class EstateModel(models.Model):
45
_name = "estate.property"
@@ -7,16 +8,30 @@ class EstateModel(models.Model):
78
name = fields.Char(required=True)
89
description = fields.Text()
910
postcode = fields.Char()
10-
date_availability = fields.Date()
11+
date_availability = fields.Date(
12+
copy=False,
13+
default= fields.Date.today() + timedelta(days=90)
14+
)
15+
active= fields.Boolean(default=True)
1116
expected_price = fields.Float(required=True)
12-
selling_price = fields.Float()
13-
bedrooms = fields.Integer()
17+
selling_price = fields.Float(readonly=True, copy=False)
18+
bedrooms = fields.Integer(default=2)
1419
living_area = fields.Integer()
1520
facades = fields.Integer()
1621
garage = fields.Boolean()
1722
garden = fields.Boolean()
1823
garden_area = fields.Integer()
24+
state= fields.Selection(
25+
string='state',
26+
default="New",
27+
required=True,
28+
copy=False,
29+
selection=[('New', 'New'),('Offer Received', 'Offer Received'),('Offer Accepted', 'Offer Accepted'),('Sold', 'Sold'), ('Cancelled', 'Cancelled'),
30+
]
31+
)
1932
garden_orientation = fields.Selection(
20-
string='Type',
21-
selection=[('north', 'North'),('south', 'South'),('east', 'East'),('west', 'West')],
33+
string='Garden Orientation',
34+
selection=[('north', 'North'),('south', 'South'),('east', 'East'),('west', 'West'),
35+
],
36+
help="Select the direction the garden faces"
2237
)

estate/views/estate_menus.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<odoo>
4+
<menuitem id="test_menu_root" name="Real Estate">
5+
<menuitem id="test_first_level_menu" name="First Level">
6+
<menuitem id="test_model_menu_action" action="action_estate_property"/>
7+
</menuitem>
8+
</menuitem>
9+
</odoo>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0"?>
2+
3+
<odoo>
4+
<record id="action_estate_property" model="ir.actions.act_window">
5+
<field name="name">Properties</field>
6+
<field name="res_model">estate.property</field>
7+
<field name="view_mode">list,form</field>
8+
<field name="help" type="html">
9+
<p class="o_view_nocontent_smiling_face">
10+
Create the first property
11+
</p>
12+
</field>
13+
</record>
14+
15+
<!-- <record id="estate_property_view_list" model="ir.ui.view">
16+
<field name="name">estate.property.list</field>
17+
<field name="model">estate.property</field>
18+
<field name="arch" type="xml">
19+
<list>
20+
</list>
21+
</field>
22+
</record>
23+
24+
<record id="estate_property_view_form" model="ir.ui.view">
25+
<field name="name">estate.property.form</field>
26+
<field name="model">estate.property</field>
27+
<field name="arch" type="xml">
28+
<form>
29+
30+
</form>
31+
</field>
32+
</record> -->
33+
</odoo>

0 commit comments

Comments
 (0)