Skip to content

Commit 066a211

Browse files
committed
[IMP] estate: menu + view form
1 parent 6753065 commit 066a211

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

estate/models/estate_property.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# Part of Odoo. See LICENSE file for full copyright and licensing details.
22

33
from odoo import fields, models
4+
from datetime import timedelta
45

56

67
class EstateProperty(models.Model):
78
_name = 'estate.property'
89
_description = 'Estate Property'
910

10-
name = fields.Char('Estate Property', translate='True')
11+
name = fields.Char('Estate Property', required=True, default='Unknown', translate='True')
1112
active = fields.Boolean('Active', default=True)
1213
description = fields.Text('Description')
1314
postcode = fields.Char('Postcode')
14-
date_availability = fields.Date('Date Availability')
15-
expected_price = fields.Float('Expected Price')
16-
selling_price = fields.Float('Selling Price')
17-
bedrooms = fields.Integer('Bedrooms')
15+
date_availability = fields.Date('Date Availability', copy=False, default=fields.Datetime.now() + timedelta(days=90))
16+
expected_price = fields.Float('Expected Price', required=True)
17+
selling_price = fields.Float('Selling Price', readonly=True, copy=False)
18+
bedrooms = fields.Integer('Bedrooms', default=2)
1819
living_area = fields.Integer('Living Area')
1920
facades = fields.Integer('Facades')
2021
garage = fields.Boolean('Garage')
@@ -26,3 +27,10 @@ class EstateProperty(models.Model):
2627
('east', 'East'),
2728
('west', 'West')]
2829
)
30+
state = fields.Selection(string='State',
31+
selection=[('new', 'New'),
32+
('offer_received', 'Offer Received'),
33+
('offer_accepted', 'Offer Accepted'),
34+
('sold', 'Sold'),
35+
('cancelled', 'Cancelled')],
36+
default='new', required=True, copy=False)

estate/views/estate_menus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
action="estate.estate_property_action"
1717
sequence="1"/>
1818

19-
</odoo>
19+
</odoo>

estate/views/estate_property_views.xml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,29 @@
66
<field name="arch" type="xml">
77
<form string="Estate Property">
88
<sheet>
9-
<field name="name"/>
9+
<group>
10+
<field name="name"/>
11+
<field name="description"/>
12+
<field name="active" invisible="True"/>
13+
</group>
14+
<group>
15+
<group>
16+
<field name="postcode"/>
17+
<field name="expected_price"/>
18+
<field name="bedrooms"/>
19+
<field name="facades"/>
20+
<field name="garden"/>
21+
<field name="garden_orientation"/>
22+
</group>
23+
<group>
24+
<field name="date_availability"/>
25+
<field name="selling_price"/>
26+
<field name="living_area"/>
27+
<field name="garage"/>
28+
<field name="garden_area"/>
29+
<field name="state"/>
30+
</group>
31+
</group>
1032
</sheet>
1133
</form>
1234
</field>
@@ -16,7 +38,7 @@
1638
<field name="name">estate.property.view.list</field>
1739
<field name="model">estate.property</field>
1840
<field name="arch" type="xml">
19-
<list string="Estate Property" editable="bottom">
41+
<list string="Estate Property">
2042
<field name="name"/>
2143
<field name="expected_price"/>
2244
</list>
@@ -29,4 +51,4 @@
2951
<field name="view_mode">list,form</field>
3052
</record>
3153

32-
</odoo>
54+
</odoo>

0 commit comments

Comments
 (0)