Skip to content

Commit e66dd36

Browse files
committed
[FIX] estate: review 1
1 parent adb3316 commit e66dd36

File tree

7 files changed

+69
-25
lines changed

7 files changed

+69
-25
lines changed

estate/__manifest__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
'name': 'Estate',
3-
'version': '0.0',
3+
'version': '1.0',
44
'depends': ['base'],
5-
'author': 'haall-odoo',
5+
'author': 'Odoo S.A.',
66
'application': True,
77
'installable': True,
88
'category': '',
99
'description': '',
10-
'license': 'GPL-3',
10+
'license': 'LGPL-3',
1111
'data': [
1212
'security/ir.model.access.csv',
1313
'views/estate_property_views.xml',
14+
'views/estate_property_type_views.xml',
1415
'views/estate_menus.xml'
1516
]
1617
}

estate/data/.gitkeep

Whitespace-only changes.

estate/models/estate_property.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
class EstateProperty(models.Model):
77
_name = "estate.property"
8-
_description = "An awesome estate module"
8+
_description = "Estate Property"
99

1010
name = fields.Char(required=True)
1111
description = fields.Text()
1212
postcode = fields.Char()
13-
date_availability = fields.Date(copy=False, default=dt.datetime.today() + dt.timedelta(days=90))
13+
date_availability = fields.Date(copy=False, default=fields.Date.add(fields.Date.today(), months=3), string="Available From")
1414
expected_price = fields.Float(required=True)
1515
selling_price = fields.Float(readonly=True, copy=False)
1616
bedrooms = fields.Integer(default=2)
@@ -21,15 +21,23 @@ class EstateProperty(models.Model):
2121
garden_area = fields.Integer()
2222
garden_orientation = fields.Selection(
2323
string='Orientation',
24-
selection=[('north', 'North'), ('west', 'West'), ('south', 'South'), ('east', 'East')],
24+
selection=[
25+
('north', 'North'),
26+
('west', 'West'),
27+
('south', 'South'),
28+
('east', 'East')
29+
],
2530
help="Choose the appropriate orientation of the garden"
2631
)
2732
active = fields.Boolean(default=True)
2833
state = fields.Selection(
2934
string="Estate status",
30-
selection=[('new', 'New'), ('offer received', 'Offer Received'), ('offer accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
35+
selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
3136
help='This field explain the estate status.',
3237
required=True,
3338
copy=False,
3439
default='new'
3540
)
41+
property_type_id = fields.Many2one("estate.property.type", string="Type")
42+
seller_id = fields.Many2one("res.users", string="Salesman", default=lambda self: self.env.user, domain="[('type', '=', 'internal')]")
43+
buyer_id = fields.Many2one("res.partner", string="Buyer", domain="[('type', '=', 'portal')]")
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
2-
access_estate_model,estate_property,model_estate_property,base.group_user,1,1,1,1
3-
portal_access_estate_model,estate_property,model_estate_property,base.group_portal,1,0,0,0
2+
access_estate_model,estate_property_users,model_estate_property,base.group_user,1,1,1,1
3+
access_estate_model_type,estate_property_type_users,model_estate_property_type,base.group_user,1,1,1,1
4+
portal_access_estate_model,estate_property_portal,model_estate_property,base.group_portal,1,0,0,0

estate/views/estate_menus.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<odoo>
33
<menuitem id="estate_menu_root" name="Estate">
44
<menuitem id="estate_first_level_menu" name="Advertisements">
5-
<menuitem id="estate_model_menu_action" action="estate_model_action"/>
5+
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
6+
</menuitem>
7+
<menuitem id="estate_preoperty_type_settings_menu" name="Settings">
8+
<menuitem id="estate_property_type_menu" action="estate_property_type_action"/>
69
</menuitem>
710
</menuitem>
8-
</odoo>
11+
</odoo>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<odoo>
3+
<record id="estate_property_type_form_view" model="ir.ui.view">
4+
<field name="name">estate.property.type.name</field>
5+
<field name="model">estate.property.type</field>
6+
<field name="arch" type="xml">
7+
<form string="New Type">
8+
<sheet>
9+
<group>
10+
<h1><field name="name" string="" placeholder="New property type"/></h1>
11+
</group>
12+
</sheet>
13+
</form>
14+
</field>
15+
</record>
16+
17+
<record id="estate_model_type_action" model="ir.actions.act_window">
18+
<field name="name">Property Types</field>
19+
<field name="res_model">estate.property.type</field>
20+
<field name="view_mode">list</field>
21+
</record>
22+
</odoo>
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0"?>
22
<odoo>
3-
<record id="estate_property_view_tree" model="ir.ui.view">
4-
<field name="name">estate.property.name</field>
3+
<record id="estate_property_view_list" model="ir.ui.view">
4+
<field name="name">estate.property.list</field>
55
<field name="model">estate.property</field>
66
<field name="arch" type="xml">
7-
<list string="Channel">
7+
<list string="Properties">
88
<field name="name" string="Title"/>
99
<field name="postcode"/>
1010
<field name="bedrooms"/>
@@ -17,64 +17,73 @@
1717
</record>
1818

1919
<record id="estate_property_form_view" model="ir.ui.view">
20-
<field name="name">estate.property.name</field>
20+
<field name="name">estate.property.form</field>
2121
<field name="model">estate.property</field>
2222
<field name="arch" type="xml">
2323
<form string="My new house">
2424
<sheet>
2525
<group>
26-
<h1><field name="name" string="" placeholder="My new house"/></h1>
26+
<h1><field name="name" nolabel="1" placeholder="My new house"/></h1>
2727
</group>
2828
<group>
2929
<group>
30-
<field name="postcode" default="1000"/>
30+
<field name="property_type_id" string="Property Type"/>
31+
<field name="postcode"/>
3132
<field name="date_availability" string="Available From"/>
3233
</group>
3334
<group>
34-
<field name="expected_price" default="150000"/>
35+
<field name="expected_price"/>
3536
<field name="selling_price"/>
3637
</group>
3738
</group>
3839
<notebook>
3940
<page string="Description">
4041
<group>
4142
<field name="description" help="When duplicated, status and date are not copied"/>
42-
<field name="bedrooms" default="4"/>
43+
<field name="bedrooms"/>
4344
<field name="living_area" string="Living Area (sqm)"/>
44-
<field name="facades" default="4"/>
45+
<field name="facades"/>
4546
<field name="garage"/>
46-
<field name="garden" default="True"/>
47+
<field name="garden"/>
4748
<field name="garden_area" string="Garden Area (sqm)"/>
4849
<field name="garden_orientation"/>
4950
</group>
5051
</page>
52+
<page string="Other Info">
53+
<group>
54+
<field name="seller_id" string="Salesman"/>
55+
<field name="buyer_id" string="Buyer"/>
56+
</group>
57+
</page>
5158
</notebook>
5259
</sheet>
5360
</form>
5461
</field>
5562
</record>
5663

5764
<record id="estate_property_search_view" model="ir.ui.view">
58-
<field name="name">estate.property.name</field>
65+
<field name="name">estate.property.search</field>
5966
<field name="model">estate.property</field>
6067
<field name="arch" type="xml">
61-
<search string="TestSearch">
68+
<search string="Search Properties">
6269
<field name="name" string="Title"/>
6370
<field name="postcode"/>
6471
<field name="expected_price"/>
6572
<field name="bedrooms"/>
6673
<field name="living_area" string="Living Area (sqm)"/>
6774
<field name="facades"/>
75+
<field name="property_type_id" string="Type"/>
6876
<separator/>
69-
<filter name="Available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer received')]"/>
77+
<filter name="Available" domain="[('state', 'in', ('new', 'offer_received'))]"/>
7078
<filter name="Postcode" context="{'group_by': 'postcode'}"/>
79+
<filter name="Type" context="{'group_by': 'property_type_id'}"/>
7180
</search>
7281
</field>
7382
</record>
7483

7584
<record id="estate_model_action" model="ir.actions.act_window">
7685
<field name="name">Properties</field>
7786
<field name="res_model">estate.property</field>
78-
<field name="view_mode">list</field>
87+
<field name="view_mode">list, form</field>
7988
</record>
8089
</odoo>

0 commit comments

Comments
 (0)