Skip to content

Commit b7d46a1

Browse files
committed
[IMP] estate: introduce property types, tags, and offers
1 parent 70f2037 commit b7d46a1

13 files changed

+133
-10
lines changed

estate/__manifest__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
{
22
'name': "Estate",
3+
'description': """
4+
Track real estate properties
5+
""",
6+
'version': '1.0',
37
'author': "sypol",
48
'license': "LGPL-3",
59
'depends': ['base'],
610
'application': True,
711
'data': [
8-
'data/ir.model.access.csv',
12+
'security/ir.model.access.csv',
913
'views/estate_property_views.xml',
14+
'views/estate_property_type_views.xml',
15+
'views/estate_property_tag_views.xml',
16+
'views/estate_property_offer_views.xml',
1017
'views/estate_menus.xml',
1118
],
1219
}

estate/data/ir.model.access.csv

Lines changed: 0 additions & 2 deletions
This file was deleted.

estate/models/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
from . import estate_property
1+
from . import (
2+
estate_property,
3+
estate_property_type,
4+
estate_property_tag,
5+
estate_property_offer,
6+
)

estate/models/estate_property.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 Types')
49+
property_tag_ids = fields.Many2many('estate.property.tag', string='Property Tags')
50+
buyer = fields.Many2one('res.partner', string='Buyer', copy=False)
51+
salesperson = fields.Many2one(
52+
'res.users', string='Salesperson', default=lambda self: self.env.user
53+
)
54+
offer_ids = fields.One2many(
55+
'estate.property.offer', 'property_id', string='Property Offers'
56+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from odoo import fields, models
2+
3+
4+
class EstatePropertyOffer(models.Model):
5+
_name = "estate.property.offer"
6+
_description = "Property Offer"
7+
8+
price = fields.Float('Price')
9+
status = fields.Selection(
10+
string='Status',
11+
selection=[
12+
('accepted', 'Accepted'),
13+
('refused', 'Refused'),
14+
],
15+
copy=False,
16+
)
17+
partner_id = fields.Many2one('res.partner', string='Partner', required=True)
18+
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 EstatePropertyTag(models.Model):
5+
_name = "estate.property.tag"
6+
_description = "Property Tag"
7+
8+
name = fields.Char('Tag', 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 EstatePropertyType(models.Model):
5+
_name = "estate.property.type"
6+
_description = "Property Type"
7+
8+
name = fields.Char('Type', required=True)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
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
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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<odoo>
3-
<menuitem id="estate_menu_root" name="Estate">
4-
<menuitem id="estate_property_first_level_menu" name="Property">
3+
<menuitem id="estate_menu_root" name="Real Estate">
4+
<menuitem id="estate_property_advertisements_menu" name="Advertisements">
55
<menuitem id="estate_property_menu_action" action="estate.estate_property_action"/>
66
</menuitem>
7+
<menuitem id="estate_property_settings_menu" name="Settings">
8+
<menuitem id="estate_property_type_menu_action"
9+
action="estate.estate_property_type_action" />
10+
<menuitem id="estate_property_tag_menu_action"
11+
action="estate.estate_property_tag_action" />
12+
</menuitem>
713
</menuitem>
814
</odoo>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="estate_property_offer_view_form" model="ir.ui.view">
4+
<field name="name">estate.property.offer.form</field>
5+
<field name="model">estate.property.offer</field>
6+
<field name="arch" type="xml">
7+
<form string="Offer">
8+
<sheet>
9+
<group>
10+
<field name="price" />
11+
<field name="partner_id" />
12+
<field name="status" />
13+
</group>
14+
</sheet>
15+
</form>
16+
</field>
17+
</record>
18+
19+
<record id="estate_property_offer_view_tree" model="ir.ui.view">
20+
<field name="name">estate.property.offer.list</field>
21+
<field name="model">estate.property.offer</field>
22+
<field name="arch" type="xml">
23+
<list string="Offers">
24+
<field name="price" />
25+
<field name="partner_id" />
26+
<field name="status" />
27+
</list>
28+
</field>
29+
</record>
30+
</odoo>

0 commit comments

Comments
 (0)