Skip to content

Commit 760802b

Browse files
committed
[IMP] Configured views and fields for estate module, fixed formatting
1 parent 19a94c2 commit 760802b

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
lines changed

estate/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
from . import models
1+
from . import models

estate/__manifest__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
'base'
66
],
77
'data': [
8+
9+
'views/estate_property_views.xml',
10+
'views/estate_menus.xml',
11+
812
'security/ir.model.access.csv',
913
],
1014
'application': True

estate/models/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
from . import estate_property
1+
from . import estate_property

estate/models/estate_property.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
1-
21
from odoo import models, fields
32

43
class EstateProperty(models.Model):
54
_name = "estate.property"
65
_description = "Real Estate module"
76

7+
88
name = fields.Char(required=True)
99
description = fields.Text()
1010
postcode = fields.Char()
11-
date_availability = fields.Date()
11+
date_availability = fields.Date(copy=False,default=fields.Date.add(fields.Date.today(),months=3))
1212
expected_price = fields.Float(required=True)
13-
selling_price = fields.Float()
14-
bedrooms = fields.Integer()
13+
selling_price = fields.Float(readonly=True,copy=False)
14+
bedrooms = fields.Integer(default=2)
1515
living_area = fields.Integer()
1616
facades = fields.Integer()
1717
garage = fields.Boolean()
1818
garden = fields.Boolean()
1919
garden_area = fields.Integer()
2020
garden_orientation = fields.Selection(
21-
string = 'Type',
22-
selection=[
21+
string = 'Orientation',
22+
selection = [
2323
('north', 'North'),
2424
('south', 'South'),
2525
('east', 'East'),
2626
('west', 'West')
2727
],
2828
)
29+
30+
active = fields.Boolean(default=True)
31+
32+
state = fields.Selection(
33+
string = 'State',
34+
selection = [
35+
('new', 'New'),
36+
('offer_received', 'Offer Received'),
37+
('offer_accepted', 'Offer Accepted'),
38+
('sold', 'Sold'),
39+
('canceled', 'Canceled'),
40+
],
41+
required = True,
42+
copy = False,
43+
default = 'new'
44+
)

estate/views/estate_menus.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<odoo>
3+
<menuitem id="real_estate_root" name="Real Estate">
4+
<menuitem id="real_estate_advertiments_menu" name="Advertisments">
5+
<menuitem id="advertisments_properties_action" name="Properties" action="estate_property_action"/>
6+
</menuitem>
7+
</menuitem>
8+
</odoo>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<odoo>
3+
<record id="estate_property_action" model="ir.actions.act_window">
4+
<field name="name">Estate Property action</field>
5+
<field name="res_model">estate.property</field>
6+
<field name="view_mode">tree,form</field>
7+
</record>
8+
</odoo>

0 commit comments

Comments
 (0)