Skip to content

Commit a5cf231

Browse files
committed
[IMP] estate : Adding features to the estate app
added tags types.. and accesses and infos in the form
1 parent 566aad6 commit a5cf231

17 files changed

+196
-15
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ MANIFEST
3333
*.manifest
3434
*.spec
3535

36+
#editor
37+
.vscode/
38+
3639
# Installer logs
3740
pip-log.txt
3841
pip-delete-this-directory.txt

estate/__manifest__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
'author': 'Odoo S.A.',
88
'application': True,
99
'license': 'LGPL-3',
10-
'depends': [
11-
'base',
10+
'depends': ['base'],
11+
'data': [
12+
'security/ir.model.access.csv',
13+
'views/estate_property_type_views.xml',
14+
'views/estate_property_tag_views.xml',
15+
'views/estate_property_offer_views.xml',
16+
'views/estate_property_views.xml',
17+
'views/estate_list.xml',
18+
'views/estate_view_form.xml',
19+
'views/estate_view_search.xml',
20+
'views/estate_menus.xml',
1221
],
13-
'data': [
14-
'security/ir.model.access.csv',
15-
'views/estate_property_views.xml',
16-
'views/estate_tree.xml',
17-
'views/estate_menus.xml',
18-
'views/estate_view_form.xml',
19-
'views/estate_view_search.xml',
20-
],
2122
}

estate/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
from . import estate_property
2+
from . import estate_property_type
3+
from . import estate_property_tag
4+
from . import estate_property_offer

estate/models/estate_property.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class EstateProperty(models.Model):
88
_description = "Estate property"
99
_order = ""
1010

11-
name = fields.Char('Title', required=True)
11+
name = fields.Text('Title', required=True)
1212
description = fields.Text('Description')
1313
post_code = fields.Char('Postcode')
1414
date_availability = fields.Date(
@@ -48,3 +48,10 @@ class EstateProperty(models.Model):
4848
copy=False,
4949
)
5050
active = fields.Boolean('Active', default=True)
51+
property_type_id = fields.Many2one("estate.property.type", string="Property Type")
52+
user_id = fields.Many2one(
53+
'res.users', string='Salesman', default=lambda self: self.env.user
54+
)
55+
buyer_id = fields.Many2one("res.partner", string="Buyer", readonly=True, copy=False)
56+
tag_ids = fields.Many2many("estate.property.tag", string="Tags")
57+
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyOffer(models.Model):
5+
_name = "estate.property.offer"
6+
_description = "Estate Property Offers"
7+
_order = "price"
8+
9+
price = fields.Float("Price", required=True)
10+
state = fields.Selection(
11+
[('accepted', 'Accepted'), ('refused', 'Refused')],
12+
string="Status",
13+
default=False,
14+
copy=False,
15+
)
16+
partner_id = fields.Many2one("res.partner", string="Partner", required=True)
17+
property_id = fields.Many2one("estate.property", string="Property", required=True)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyTag(models.Model):
5+
_name = "estate.property.tag"
6+
_description = "Estate Property Tag"
7+
_order = "name"
8+
9+
name = fields.Char("Name", required=True)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyType(models.Model):
5+
_name = "estate.property.type"
6+
_description = "Estate Property Type"
7+
_order = "sequence, name"
8+
9+
name = fields.Char("Name", required=True)
10+
sequence = fields.Integer("Sequence")
11+
property_ids = fields.One2many(
12+
"estate.property", "property_type_id", string="Properties"
13+
)
14+
offer_count = fields.Integer(string="Offers count", compute="_compute_offer")
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
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
1+
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
3+
access_estate_property_type,access.estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
4+
access_estate_property_tag,access.estate.property.tag,model_estate_property_tag,base.group_user,1,1,1,1
5+
access_estate_property_offer,access.estate.property.offer,model_estate_property_offer,base.group_user,1,1,1,1

estate/views/estate_tree.xml renamed to estate/views/estate_list.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<field name="arch" type="xml">
66
<list string="Estate Properties">
77
<field name="name"/>
8+
<field name="tag_ids" widget="many2many_tags"/>
89
<field name="post_code"/>
910
<field name="bedrooms"/>
1011
<field name="living_area"/>

estate/views/estate_menus.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<odoo>
22
<menuitem id="estate_menu_root" name="Real Estate">
33
<menuitem id="estate_menu_advertisements" name="Advertisements">
4-
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
4+
<menuitem id="estate_property_menu_action" name="Properties" action="estate_property_action"/>
5+
</menuitem>
6+
<menuitem id="estate_menu_settings" name="Settings">
7+
<menuitem id="estate_property_type_menu_action" name="Property Types" action="estate_property_type_action"/>
8+
<menuitem id="estate_property_tag_menu_action" name="Property Tags" action="estate_property_tag_action" />
59
</menuitem>
610
</menuitem>
7-
</odoo>
11+
</odoo>

0 commit comments

Comments
 (0)