Skip to content

Commit 9aad959

Browse files
committed
[IMP] estate: add personal views and filters
1 parent 5b02c63 commit 9aad959

File tree

2 files changed

+82
-4
lines changed

2 files changed

+82
-4
lines changed

estate/models/estate_property.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ class EstateProperty(models.Model):
1010
name = fields.Char(required=True)
1111
description = fields.Text()
1212
postcode = fields.Char()
13-
date_availability = fields.Date("Available from", default=fields.Date().add(fields.Date().today(), months=3),
13+
date_availability = fields.Date("Available from", default=lambda _: fields.Date().add(fields.Date().today(), months=3),
1414
copy=False)
1515
expected_price = fields.Float(required=True)
1616
selling_price = fields.Float(readonly=True, copy=False)
1717
bedrooms = fields.Integer(default=2)
18-
living_area = fields.Integer()
18+
living_area = fields.Integer("Living Area (sqm)")
1919
facades = fields.Integer()
2020
garage = fields.Boolean()
2121
garden = fields.Boolean()
22-
garden_area = fields.Integer()
22+
garden_area = fields.Integer("Garden Area (sqm)")
2323
garden_orientation = fields.Selection(string='Garden Orientation',
2424
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'),
2525
('west', 'West')])

estate/views/estate_property_views.xml

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,83 @@
11
<?xml version="1.0"?>
22
<odoo>
3+
<record id="real_estate_view_search" model="ir.ui.view">
4+
<field name="name">estate.search</field>
5+
<field name="model">estate.property</field>
6+
<field name="arch" type="xml">
7+
<search string="Real Estate">
8+
<field name="name"/>
9+
<field name="postcode"/>
10+
<field name="expected_price"/>
11+
<field name="bedrooms"/>
12+
<field name="living_area"/>
13+
<field name="facades"/>
14+
15+
<filter string="Available" name="state"
16+
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer received')]"/>
17+
<filter name="postcode" context="{'group_by': 'postcode'}"/>
18+
</search>
19+
</field>
20+
</record>
21+
22+
<record id="real_estate_view_form" model="ir.ui.view">
23+
<field name="name">estate.form</field>
24+
<field name="model">estate.property</field>
25+
<field name="arch" type="xml">
26+
<form string="Real Estate">
27+
<sheet>
28+
<h1 class="mb32">
29+
<field name="name"/>
30+
</h1>
31+
32+
<group>
33+
<group>
34+
<field name="postcode"/>
35+
<field name="date_availability"/>
36+
</group>
37+
38+
<group>
39+
<field name="expected_price"/>
40+
<field name="selling_price"/>
41+
</group>
42+
43+
<div class="mb32"/> <!-- To add a blank line -->
44+
45+
<notebook>
46+
<page string="Description">
47+
<group>
48+
<field name="description"/>
49+
<field name="bedrooms"/>
50+
<field name="living_area"/>
51+
<field name="facades"/>
52+
<field name="garage"/>
53+
<field name="garden"/>
54+
<field name="garden_area"/>
55+
<field name="garden_orientation"/>
56+
<field name="state"/>
57+
</group>
58+
</page>
59+
</notebook>
60+
</group>
61+
</sheet>
62+
</form>
63+
</field>
64+
</record>
65+
66+
<record id="real_estate_view_tree" model="ir.ui.view">
67+
<field name="name">estate.tree</field>
68+
<field name="model">estate.property</field>
69+
<field name="arch" type="xml">
70+
<tree string="Channel">
71+
<field name="name"/>
72+
<field name="postcode"/>
73+
<field name="bedrooms"/>
74+
<field name="living_area"/>
75+
<field name="expected_price"/>
76+
<field name="selling_price"/>
77+
<field name="date_availability"/>
78+
</tree>
79+
</field>
80+
</record>
381

482
<record id="real_estate_action" model="ir.actions.act_window">
583
<field name="name">Properties</field>
@@ -13,4 +91,4 @@
1391
</p>
1492
</field>
1593
</record>
16-
</odoo>
94+
</odoo>

0 commit comments

Comments
 (0)