Skip to content

Commit 5b6bde8

Browse files
committed
[IMP] estate: introduce various new data in the estate property model: buyer, salesperson, property type, list of tags and list of offers.
Buyer Can be any individual (res.partner) Salesperson Has to be an employe (res.user) Property type New model with the name of the type (estate.property.type) Tags New model with the name of the tag (estate.property.tag) Offers New model with the buyer, price, status and property id (estate.property.offer) All those new models have list and form view but the offer model is only accessible from the porperty form (as each offer is linked to a property) A new menu setting has been added to allow the creation of new tags and types.
1 parent a76b9fe commit 5b6bde8

12 files changed

+138
-3
lines changed

estate/__manifest__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
'installable': True,
77
'application': True,
88
'data': [
9+
'views/estate_property_offer_views.xml',
10+
'views/estate_property_type_views.xml',
11+
'views/estate_property_tag_views.xml',
912
'views/estate_property_views.xml',
1013
'views/estate_menus.xml',
1114

estate/models/__init__.py

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

estate/models/estate_property.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ class EstateProperty(models.Model):
3333
('offer_accepted', 'Offer Accepted'),
3434
('sold', 'Sold'),
3535
('cancelled', 'Cancelled')
36-
], string="State", default='new', required=True, copy=False)
36+
], string="State", default='new', required=True, copy=False)
37+
property_type_id = fields.Many2one('estate.property.type', string="Property type")
38+
property_buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False)
39+
property_salesperson_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user)
40+
property_tag_ids = fields.Many2many('estate.property.tag', string="Property tags")
41+
property_offer_ids = fields.One2many('estate.property.offer', 'property_id', string='Offers')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from odoo import fields, models
2+
3+
class EstatePropertyOffer(models.Model):
4+
_name = "estate.property.offer"
5+
_description = "A property offer"
6+
7+
price = fields.Float('Price')
8+
status = fields.Selection(selection=[
9+
('accepted', 'Accepted'),
10+
('refused', 'Refused')
11+
], copy=False, string='Status')
12+
property_buyer_id = fields.Many2one('res.partner', string="Buyer", required=True)
13+
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+
class EstatePropertyTag(models.Model):
4+
_name = "estate.property.tag"
5+
_description = "A property tag"
6+
7+
name = fields.Char('Property tag', 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+
class EstatePropertyType(models.Model):
4+
_name = "estate.property.type"
5+
_description = "A property type is, for example, a house or an apartment. It is a standard business need to categorize properties according to their type, especially to refine filtering."
6+
7+
name = fields.Char('Property type', required=True)
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-
access_real_estate_platform,estate_property,model_estate_property,base.group_user,1,1,1,1
2+
access_real_estate_platform,estate_property,model_estate_property,base.group_user,1,1,1,1
3+
access_real_estate_type,estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
4+
access_real_estate_tag,estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1
5+
access_real_estate_offer,estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1

estate/views/estate_menus.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
<menuitem id="estate_advertisements" name="Advertisements">
55
<menuitem id="estate_property_menu_action" action="estate_property_action"/>
66
</menuitem>
7+
<menuitem id="estate_settings" name="Settings">
8+
<menuitem id="estate_property_type_menu_action" action="estate_property_type_action"/>
9+
<menuitem id="estate_property_tag_menu_action" action="estate_property_tag_action"/>
10+
</menuitem>
711
</menuitem>
812
</odoo>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0"?>
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="Estate Property Offer">
8+
<sheet>
9+
<group>
10+
<field name="price"/>
11+
<field name="property_buyer_id"/>
12+
<field name="status"/>
13+
</group>
14+
</sheet>
15+
</form>
16+
</field>
17+
</record>
18+
19+
<record id="estate_property_offer_view_list" 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="Estate property offer">
24+
<field name="price"/>
25+
<field name="property_buyer_id" string="Partner"/>
26+
<field name="status"/>
27+
</list>
28+
</field>
29+
</record>
30+
</odoo>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<odoo>
3+
<record id="estate_property_tag_view_form" model="ir.ui.view">
4+
<field name="name">estate.property.tag.form</field>
5+
<field name="model">estate.property.tag</field>
6+
<field name="arch" type="xml">
7+
<form string="Estate Property Type">
8+
<sheet>
9+
<h1><group>
10+
<field name="name" string="Tag"/>
11+
</group></h1>
12+
</sheet>
13+
</form>
14+
</field>
15+
</record>
16+
17+
<record id="estate_property_tag_action" model="ir.actions.act_window">
18+
<field name="name">Property Tags</field>
19+
<field name="res_model">estate.property.tag</field>
20+
<field name="view_mode">list,form</field>
21+
</record>
22+
</odoo>

0 commit comments

Comments
 (0)