Skip to content

Commit 036cef9

Browse files
committed
[IMP] estate: adding list,form, search views (filters + group by)
add: state field to the estate_property model security: readonly and all-rights security groups are created views: list, form, search views are created, in search view state filter and postcode groupby features are added manifest is updated with the security file
1 parent 8924506 commit 036cef9

File tree

5 files changed

+118
-13
lines changed

5 files changed

+118
-13
lines changed

estate/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"installable": True,
88
"depends": ["base"],
99
"data": [
10+
"security/security.xml",
1011
"security/ir.model.access.csv",
1112
"views/estate_property_views.xml",
1213
"views/estate_menus.xml",

estate/models/estate_property.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class EstateProperty(models.Model):
77
_name = "estate_property"
88
_description = "Estate Property"
9-
name = fields.Char(required=True)
9+
name = fields.Char("Title", required=True)
1010
description = fields.Text()
1111
postcode = fields.Char()
1212
date_availability = fields.Date(
@@ -15,30 +15,30 @@ class EstateProperty(models.Model):
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()
2222
garden_area = fields.Integer()
2323
garden_orientation = fields.Selection(
2424
string="Orientation",
2525
selection=[
26-
("North", "North"),
27-
("South", "South"),
28-
("East", "East"),
29-
("West", "West"),
26+
("north", "North"),
27+
("south", "South"),
28+
("east", "East"),
29+
("west", "West"),
3030
],
3131
)
3232
active = fields.Boolean(default=True)
3333
state = fields.Selection(
3434
selection=[
35-
("New", "New"),
36-
("Offer Received", "Offer Received"),
37-
("Offer Accepted", "Offer Accepted"),
38-
("Sold", "Sold"),
39-
("Cancelled", "Cancelled"),
35+
("new", "New"),
36+
("offer_received", "Offer Received"),
37+
("offer_accepted", "Offer Accepted"),
38+
("sold", "Sold"),
39+
("cancelled", "Cancelled"),
4040
],
41-
default="New",
41+
default="new",
4242
required=True,
4343
copy=False,
4444
)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
2-
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
2+
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
3+
access_estate_property_readonly,access_estate_property_readonly,model_estate_property,group_readonly_user,1,0,0,0

estate/security/security.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<odoo>
2+
<data>
3+
<record id="group_all_rights_user" model="res.groups">
4+
<field name="name">Complete User</field>
5+
</record>
6+
<record id="group_readonly_user" model="res.groups">
7+
<field name="name">Readonly User</field>
8+
</record>
9+
</data>
10+
</odoo>

estate/views/estate_property_views.xml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,98 @@
11
<?xml version="1.0"?>
22
<odoo>
3+
<record id="estate_property_view_list" model="ir.ui.view">
4+
<field name="name">estate_property.list</field>
5+
<field name="model">estate_property</field>
6+
<field name="arch" type="xml">
7+
<list>
8+
<field name="name" />
9+
<field name="postcode" />
10+
<field name="bedrooms" />
11+
<field name="living_area" />
12+
<field name="expected_price" />
13+
<field name="selling_price" />
14+
<field name="date_availability" />
15+
</list>
16+
</field>
17+
</record>
18+
19+
<record id="estate_property_view_search" model="ir.ui.view">
20+
<field name="name">estate_property.search</field>
21+
<field name="model">estate_property</field>
22+
<field name="arch" type="xml">
23+
<search>
24+
<field name="name" string="Title" />
25+
<field name="postcode" />
26+
<field name="expected_price" />
27+
<field name="bedrooms" />
28+
<field name="living_area" />
29+
<field name="facades" />
30+
<filter string="Available Properties" name="available_properties"
31+
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" />
32+
<filter name="group_by_postcode" context="{'group_by': 'postcode'}" />
33+
</search>
34+
</field>
35+
</record>
36+
37+
<record id="estate_property_view_form" model="ir.ui.view">
38+
<field name="name">estate_property.form</field>
39+
<field name="model">estate_property</field>
40+
<field name="arch" type="xml">
41+
<form string="Test">
42+
<sheet>
43+
<h1>
44+
<field name="name" />
45+
</h1>
46+
<group>
47+
<group>
48+
<field name="postcode" string="Postcode" />
49+
</group>
50+
<group>
51+
<field name="expected_price" string="Expected Price" />
52+
</group>
53+
54+
</group>
55+
<group>
56+
<group>
57+
<field name="date_availability" string="Available From" />
58+
</group>
59+
<group>
60+
<field name="selling_price" string="Selling Price" />
61+
</group>
62+
</group>
63+
<notebook>
64+
<page string="Description">
65+
<group>
66+
<field name="description" string="Description" />
67+
</group>
68+
<group>
69+
<field name="bedrooms" string="Bedrooms" />
70+
</group>
71+
<group>
72+
<field name="living_area" string="Living Area (sqm)" />
73+
</group>
74+
<group>
75+
<field name="facades" string="Facades" />
76+
</group>
77+
<group>
78+
<field name="garage" string="Garage" />
79+
</group>
80+
<group>
81+
<field name="garden" string="Garden" />
82+
</group>
83+
<group>
84+
<field name="garden_area" string="Garden Area (sqm)" />
85+
</group>
86+
<group>
87+
<field name="garden_orientation" string="Garden Orientation" />
88+
</group>
89+
<field name="state" />
90+
</page>
91+
</notebook>
92+
</sheet>
93+
</form>
94+
</field>
95+
</record>
396
<record id="estate_property_action" model="ir.actions.act_window">
497
<field name="name">Properties</field>
598
<field name="res_model">estate_property</field>

0 commit comments

Comments
 (0)