Skip to content

Commit 6eb9eaf

Browse files
committed
[ADD] estate: created relations between models
1 parent f46bda6 commit 6eb9eaf

12 files changed

+133
-9
lines changed

estate/__manifest__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
'data': [
77
'security/ir.model.access.csv',
88
'views/estate_property_views.xml',
9-
'views/estate_menus.xml'
9+
'views/estate_property_type_views.xml',
10+
'views/estate_property_tag_views.xml',
11+
'views/estate_property_offer_views.xml',
12+
'views/estate_menus.xml',
1013
]
1114
}

estate/models/__init__.py

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ class EstateModel(models.Model):
3434
selection=[('north', 'North'),('south', 'South'),('east', 'East'),('west', 'West'),
3535
],
3636
help="Select the direction the garden faces"
37-
)
37+
)
38+
property_type_id= fields.Many2one("estate.property.type")
39+
buyer= fields.Many2one("res.partner")
40+
salesman= fields.Many2one("res.users")
41+
tag_ids= fields.Many2many("estate.property.tag")
42+
offer_ids= fields.One2many("estate.property.offer", inverse_name="property_id")
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+
class EstateOfferModel(models.Model):
4+
_name = "estate.property.offer"
5+
_description = "Real Estate Property Offer Model"
6+
7+
price = fields.Float()
8+
status = fields.Selection([
9+
('Accepted', 'Accepted'),
10+
('Refused', 'Refused')
11+
], copy=False)
12+
partner_id= fields.Many2one('res.partner', required=True)
13+
property_id= fields.Many2one('estate.property', required=True)

estate/models/estate_property_tag.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from odoo import models, fields
2+
3+
class EstateTagModel(models.Model):
4+
_name = "estate.property.tag"
5+
_description = "Real Estate Property Tag Model"
6+
7+
name = fields.Char(required=True)

estate/models/estate_property_type.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from odoo import models, fields
2+
3+
class EstateTypeModel(models.Model):
4+
_name = "estate.property.type"
5+
_description = "Real Estate Property Type Model"
6+
7+
name = fields.Char(required=True)

estate/security/ir.model.access.csv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2-
access_estate_property_user,model_estate_property,model_estate_property,base.group_user,1,1,1,1
2+
access_estate_property_user,model_estate_property,model_estate_property,base.group_user,1,1,1,1
3+
access_estate_property_type_user,model_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
4+
access_estate_property_tag_user,model_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1
5+
access_estate_property_offer_user,model_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1
6+

estate/views/estate_menus.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<odoo>
4-
<menuitem id="test_menu_root" name="Real Estate">
5-
<menuitem id="test_first_level_menu" name="First Level">
6-
<menuitem id="test_model_menu_action" action="action_estate_property"/>
4+
<menuitem id="estate_menu_root" name="Real Estate">
5+
6+
<menuitem id="estate_advertisements_menu" name="Advertisements">
7+
<menuitem id="estate_property_adv_menu_action" action="action_estate_property" name="Property"/>
8+
</menuitem>
9+
10+
<menuitem id="estate_settings_menu" name="Settings">
11+
<menuitem id="estate_property_menu_action" action="action_estate_property" name="Property"/>
12+
<menuitem id="estate_property_type_menu_action" action="action_estate_property_type" name="Property Types"/>
13+
<menuitem id="estate_property_tag_menu_action" action="action_estate_property_tag" name="Property Tags"/>
714
</menuitem>
15+
816
</menuitem>
917
</odoo>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
3+
<odoo>
4+
<record id="action_estate_property_offer" model="ir.actions.act_window">
5+
<field name="name">Property Offers</field>
6+
<field name="res_model">estate.property.offer</field>
7+
<field name="view_mode">list,form</field>
8+
<field name="help" type="html">
9+
<p class="o_view_nocontent_smiling_face">
10+
Create the first property Type
11+
</p>
12+
</field>
13+
</record>
14+
15+
<!-- list view -->
16+
<record id="list_view_estate_property_offer" model="ir.ui.view">
17+
<field name="name">Estate Properties Offer list</field>
18+
<field name="model">estate.property.offer</field>
19+
<field name="arch" type="xml">
20+
<list>
21+
<field name="price" string="Price" />
22+
<field name="partner_id" string="Partner" />
23+
<field name="status" string="Status" />
24+
</list>
25+
</field>
26+
</record>
27+
28+
</odoo>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
3+
<odoo>
4+
<record id="action_estate_property_tag" model="ir.actions.act_window">
5+
<field name="name">Property Tag</field>
6+
<field name="res_model">estate.property.tag</field>
7+
<field name="view_mode">list,form</field>
8+
<field name="help" type="html">
9+
<p class="o_view_nocontent_smiling_face">
10+
Create the first property Tag
11+
</p>
12+
</field>
13+
</record>
14+
15+
</odoo>

0 commit comments

Comments
 (0)