Skip to content

Commit a380279

Browse files
committed
[IMP] estate: added offer,tag and type models and created views.
1 parent 2f95e0f commit a380279

File tree

10 files changed

+107
-28
lines changed

10 files changed

+107
-28
lines changed

estate/__init__.py

100644100755
File mode changed.

estate/__manifest__.py

100644100755
File mode changed.

estate/models/__init__.py

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
from . import estate_property
1+
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

100644100755
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class EstateProperty(models.Model):
1111
postcode = fields.Char()
1212
date_avaliability = fields.Date(
1313
copy=False,
14-
default=date_utils.add(fields.Date.today(),month=2),
14+
default=date_utils.add(fields.Date.today(), month=2),
1515
)
1616
expected_price = fields.Float(required=True)
1717
selling_price = fields.Float(readonly=True, copy=False)
@@ -45,3 +45,12 @@ class EstateProperty(models.Model):
4545
copy=False,
4646
default="new",
4747
)
48+
property_type_id = fields.Many2one("estate.property.type", string="Property Type")
49+
customer = fields.Many2one("res.users", string="Customer", copy=False)
50+
salesperson = fields.Many2one(
51+
"res.partner",
52+
string="Salesperson",
53+
default =lambda self:self.env.user
54+
)
55+
tag_ids = fields.Many2many("estate.property.tag", string="Property Tags")
56+
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offer")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from odoo import models, fields
2+
3+
4+
class EstatePropertyOffer(models.Model):
5+
_name = "estate.property.offer"
6+
_description = "Estate Property Offer"
7+
8+
price = fields.Float()
9+
status = fields.Selection(
10+
selection=[("accepted", "Accepted"), ("refused", "Refused")], copy=False
11+
)
12+
partner_id = fields.Many2one("res.partner", string="Partner", required=True)
13+
property_id = fields.Many2one("estate.property", string="Property", required=True)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyTags(models.Model):
5+
_name = "estate.property.tag"
6+
_description = "Estate Property Tag"
7+
8+
name = fields.Char(required=True)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from odoo import models, fields
2+
3+
4+
class EstatePropertyType(models.Model):
5+
_name = "estate.property.type"
6+
_description = "Estate Property Type"
7+
8+
name = fields.Char(required=True)

estate/security/ir.model.access.csv

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2-
estate.access_estate_property,"access_estate_property",estate.model_estate_property,base.group_user,1,1,1,1
2+
estate.access_estate_property,"access_estate_property",estate.model_estate_property,base.group_user,1,1,1,1
3+
estate.access_estate_property_type,"access_estate_property_type",estate.model_estate_property_type,base.group_user,1,1,1,1
4+
estate.access_estate_property_tag,"access_estate_property_tag",estate.model_estate_property_tag,base.group_user,1,1,1,1
5+
estate.access_estate_property_offer,"access_estate_property_offer",estate.model_estate_property_offer,base.group_user,1,1,1,1

estate/views/estate_menus.xml

100644100755
Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
<odoo>
22
<menuitem id="estate_menu_root"
33
name="Estate Property"
4-
action="action_estate"/>
5-
6-
<menuitem id="estate_menu_advertisements"
7-
name="Advertisements"
8-
parent="estate_menu_root"
9-
action="action_estate_advertisements"
10-
sequence = "1"/>
4+
action="action_estate"/>
115

126
<menuitem id="estate_menu_configuration"
137
name="Settings"
148
parent="estate_menu_root"/>
159

16-
<menuitem id="configuration_menu_option_1"
17-
name="Option 1"
18-
parent="estate_menu_configuration"
19-
action="action_estate_configure"/>
20-
21-
<menuitem id="configuration_menu_option_2"
22-
name="Option 2"
10+
<menuitem id="configuration_menu_property_types"
11+
name="Property Types"
2312
parent="estate_menu_configuration"
24-
action="action_estate_configure"/>
13+
action="action_estate_property_type"/>
2514

26-
<menuitem id="configuration_menu_option_3"
27-
name="Option 3"
15+
<menuitem id="configuration_menu_property_tags"
16+
name="Property Tags"
2817
parent="estate_menu_configuration"
29-
action="action_estate_configure"/>
18+
action="action_estate_property_tag"/>
3019
</odoo>

estate/views/estate_property_views.xml

100644100755
Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,35 @@
1010
</field>
1111
</record>
1212

13-
<record id="action_estate_advertisements" model="ir.actions.act_window">
14-
<field name="name">Advertisements</field>
13+
<record id="action_estate_property_type" model="ir.actions.act_window">
14+
<field name="name">Properties Types</field>
15+
<field name="res_model">estate.property.type</field>
16+
<field name="view_mode">list,form</field>
1517
<field name="help" type="html">
1618
<p class="o_view_nocontent_smiling_face">
17-
advertisements!
19+
Create your first Property Type!
1820
</p>
1921
</field>
2022
</record>
2123

22-
<record id="action_estate_configure" model="ir.actions.act_window">
23-
<field name="name">Settings</field>
24+
<record id="action_estate_property_tag" model="ir.actions.act_window">
25+
<field name="name">Properties Tags</field>
26+
<field name="res_model">estate.property.tag</field>
27+
<field name="view_mode">list,form</field>
2428
<field name="help" type="html">
2529
<p class="o_view_nocontent_smiling_face">
26-
Empty!
30+
Create your first Property Tag!
2731
</p>
2832
</field>
2933
</record>
3034

31-
<record id="action_estate_view_tree" model="ir.ui.view">
35+
<record id="action_estate_view_list" model="ir.ui.view">
3236
<field name="name">estate.property.list</field>
3337
<field name="model">estate.property</field>
3438
<field name="arch" type="xml">
3539
<list string="Channel">
3640
<field name="name" string="Title"/>
41+
<field name="property_type_id"/>
3742
<field name="postcode"/>
3843
<field name="bedrooms"/>
3944
<field name="living_area" string="Living Area(sqm)"/>
@@ -53,10 +58,13 @@
5358
<group>
5459
<group>
5560
<field name="name" string="Title"/>
61+
<field name="tag_ids" widget="many2many_tags"/>
5662
<field name="postcode"/>
5763
<field name="date_avaliability" string="Avaliable From"/>
5864
</group>
5965
<group>
66+
<separator/>
67+
<field name="property_type_id"/>
6068
<field name="expected_price"/>
6169
<field name="selling_price"/>
6270
</group>
@@ -80,12 +88,49 @@
8088
</group>
8189
</group>
8290
</page>
91+
<page string="Offers">
92+
<field name="offer_ids"/>
93+
</page>
94+
<page string="Other info">
95+
<group>
96+
<field name="customer"/>
97+
<field name="salesperson"/>
98+
</group>
99+
</page>
83100
</notebook>
84101
</sheet>
85102
</form>
86103
</field>
87104
</record>
88105

106+
<record id="action_estate_offer_view_list" model="ir.ui.view">
107+
<field name="name">estate.property.offer.list</field>
108+
<field name="model">estate.property.offer</field>
109+
<field name="arch" type="xml">
110+
<list string="Channel">
111+
<field name="price"/>
112+
<field name="partner_id"/>
113+
<field name="status"/>
114+
</list>
115+
</field>
116+
</record>
117+
118+
<record id="action_estate_offer_view_form" model="ir.ui.view">
119+
<field name="name">estate.property.offer.form</field>
120+
<field name="model">estate.property.offer</field>
121+
<field name="arch" type="xml">
122+
<form string="Property">
123+
<sheet>
124+
<group>
125+
<field name="price"/>
126+
<field name="partner_id"/>
127+
<field name="status"/>
128+
</group>
129+
</sheet>
130+
</form>
131+
</field>
132+
</record>
133+
89134
<record id="action_estate_view_search" model="ir.ui.view">
90135
<field name="name">estate.property.search</field>
91136
<field name="model">estate.property</field>
@@ -97,6 +142,7 @@
97142
<field name="living_area" string="Living Area(sqm)"/>
98143
<field name="expected_price"/>
99144
<field name="facades"/>
145+
<field name="property_type_id"/>
100146
<separator/>
101147
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
102148
<filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/>

0 commit comments

Comments
 (0)