Skip to content

Commit cef161e

Browse files
committed
[IMP] estate: Property Types, tags, offers added
Repo now is up to date with chapter 7
1 parent 7a2a1fe commit cef161e

File tree

8 files changed

+123
-5
lines changed

8 files changed

+123
-5
lines changed

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: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from datetime import date
44

55

6-
class TestModel(models.Model):
6+
class EstateProperty(models.Model):
77
_name = "estate.property"
8-
_description = "A test description"
8+
_description = "A property module that adds the property as a listing"
99
name = fields.Char(required=True)
1010
description = fields.Text()
1111
postcode = fields.Char()
@@ -41,3 +41,12 @@ class TestModel(models.Model):
4141
copy=False,
4242
default="new",
4343
)
44+
property_type_id = fields.Many2one("estate.property.type")
45+
buyer_id = fields.Many2one("res.partner", copy=False)
46+
seller_id = fields.Many2one(
47+
"res.users", name="Salesperson", default=lambda self: self.env.user
48+
)
49+
tag_ids = fields.Many2many("estate.property.tag", string="Tags")
50+
offers_ids = fields.One2many(
51+
"estate.property.offer", "property_id", string="Offers"
52+
)
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 = "Offers made on a listing"
7+
price = fields.Float()
8+
status = fields.Selection(
9+
string="Status",
10+
selection=[
11+
("accepted", "Accepted"),
12+
("refused", "Refused"),
13+
],
14+
copy=False,
15+
)
16+
partner_id = fields.Many2one("res.partner", string="Buyer", required=True)
17+
property_id = fields.Many2one("estate.property", string="Property", required=True)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyTag(models.Model):
5+
_name = "estate.property.tag"
6+
_description = "Adds different property tags"
7+
name = fields.Char(required=True)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyType(models.Model):
5+
_name = "estate.property.type"
6+
_description = "Adds different property types"
7+
name = fields.Char(required=True)
Lines changed: 3 additions & 0 deletions
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
22
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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<odoo>
33
<menuitem id="estate_menu_root" name="Real Estate">
4-
<menuitem id="estate_first_level_menu" name="Advertisements">
5-
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
4+
<menuitem id="estate_ads_menu" name="Advertisements">
5+
<menuitem id="estate_property_menu_action"
6+
action="estate_property_action"/>
7+
</menuitem>
8+
<menuitem id="estate_settings_menu" name="Settings">
9+
<menuitem id="estate_property_type_menu_action"
10+
action="estate_property_type_action"/>
11+
<menuitem id="estate_property_tag_menu_action"
12+
action="estate_property_tag_action"/>
613
</menuitem>
714
</menuitem>
815
</odoo>

estate/views/estate_property_views.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<odoo>
3-
<record id="estate_property_view_searc" model="ir.ui.view">
3+
<record id="estate_property_view_search" model="ir.ui.view">
44
<field name="name">estate.property.search</field>
55
<field name="model">estate.property</field>
66
<field name="arch" type="xml">
@@ -29,8 +29,10 @@
2929
<h1>
3030
<field name="name"/>
3131
</h1>
32+
<field name="tag_ids" widget="many2many_tags"/>
3233
<group>
3334
<group>
35+
<field name="property_type_id"/>
3436
<field name="postcode"/>
3537
<field name="date_availability" string="Available From"/>
3638
</group>
@@ -52,6 +54,15 @@
5254
<field name="garden_orientation"/>
5355
</group>
5456
</page>
57+
<page string="Offers">
58+
<field name = "offers_ids"/>
59+
</page>
60+
<page string="Other info">
61+
<group>
62+
<field name="seller_id" string="Salesman"/>
63+
<field name="buyer_id"/>
64+
</group>
65+
</page>
5566
</notebook>
5667
</sheet>
5768
</form>
@@ -79,4 +90,58 @@
7990
<field name="res_model">estate.property</field>
8091
<field name="view_mode">list,form</field>
8192
</record>
93+
94+
95+
96+
<record id="estate_property_type_view_form" model="ir.ui.view">
97+
<field name="name">estate.property.type.form</field>
98+
<field name="model">estate.property.type</field>
99+
<field name="arch" type="xml">
100+
<form string="Type">
101+
<sheet>
102+
<h1>
103+
<field name="name"/>
104+
</h1>
105+
</sheet>
106+
</form>
107+
</field>
108+
</record>
109+
110+
<record id="estate_property_type_action" model="ir.actions.act_window">
111+
<field name="name">Property Types</field>
112+
<field name="res_model">estate.property.type</field>
113+
<field name="view_mode">list,form</field>
114+
</record>
115+
116+
<record id="estate_property_tag_view_form" model="ir.ui.view">
117+
<field name="name">estate.property.tag.form</field>
118+
<field name="model">estate.property.tag</field>
119+
<field name="arch" type="xml">
120+
<form string="Type">
121+
<sheet>
122+
<h1>
123+
<field name="name"/>
124+
</h1>
125+
</sheet>
126+
</form>
127+
</field>
128+
</record>
129+
130+
<record id="estate_property_tag_action" model="ir.actions.act_window">
131+
<field name="name">Property Tags</field>
132+
<field name="res_model">estate.property.tag</field>
133+
<field name="view_mode">list,form</field>
134+
</record>
135+
136+
<record id="estate_property_offer_view_list" model="ir.ui.view">
137+
<field name="name">estate.property.offer.list</field>
138+
<field name="model">estate.property.offer</field>
139+
<field name="arch" type="xml">
140+
<list string="Offers">
141+
<field name="price"/>
142+
<field name="partner_id" string="Partner"/>
143+
<field name="status"/>
144+
</list>
145+
</field>
146+
</record>
82147
</odoo>

0 commit comments

Comments
 (0)