Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b8ffb50
[ADD] '.idea' to gitignore
Sep 15, 2026
c27b529
[ADD] estate: initial setup
Sep 15, 2026
b07504a
[IMP] estate: fixing nomenclature
Sep 15, 2026
ab59585
[IMP] estate: adding new line at the end of the manifest
Sep 15, 2026
26f6c3f
[ADD] estate_property model: creation with basic fields
Sep 15, 2026
cd55406
[IMP] estate security: adding access rule
Sep 15, 2026
739446b
[IMP] estate security: adding security rules .csv to manifest
Sep 15, 2026
793fb92
[FIX] estate module: quick fix for missing new_line at the end + opti…
Sep 15, 2026
ad96a89
[FIX] estate security: updating access rule model_id to base.group_user
Sep 15, 2026
0776651
[IMP] estate property xml view: adding the xml file and defining it i…
Sep 15, 2026
87c5088
[IMP] estate views: update property action, add menu structure and fi…
Sep 16, 2026
dfd8370
[IMP] estate_property model: enhance fields with defaults, readonly
Sep 16, 2026
21e0c6e
[FIX] .gitignore: removing .idea
Sep 16, 2026
2402326
[IMP] adding estate_property_list_view
Sep 16, 2026
79ef1cf
[IMP] estate_property views: adding xml form and search views
Sep 17, 2026
2dd86af
[ADD] estate_property_type model: adding the new model
Sep 17, 2026
165bd74
[IMP] estate_property_type : views, security, adding it to the main menu
Sep 17, 2026
b106c45
[IMP] many2one fields property_type in estate_property model
Sep 17, 2026
93e6eb6
[FIX] updating estate_property_form_view to reflect changes
Sep 17, 2026
cbcbb83
[IMP] estate_property buyer and salesman fields
Sep 17, 2026
e99adcb
[IMP] estate_property_form_view: adding salesman and buyer to it
Sep 17, 2026
eda7bb0
[ADD] estate_property_tag:
Sep 17, 2026
9a75bdd
[IMP] estate_property model: adding the tag field and updating the fo…
Sep 17, 2026
9422adf
[ADD] estate_property_offer model:
Sep 17, 2026
4759e22
[FIX] estate_property_offer model: adding string name to fields
Sep 17, 2026
be20691
[IMP] estate_property model:
Sep 17, 2026
4f186f7
[IMP] estate_property model:
Sep 17, 2026
9683dc1
[IMP] estate_property model: adding best offer and date_deadline comp…
Sep 17, 2026
c02518b
[IMP] estate_property model: adding on change on garden, managing gar…
Sep 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
'name': 'Real Estate',
'author': 'Odoo S.A',
'depends': [
'base'
],
'application': True,
'license': 'LGPL-3',
'data': [
'security/ir.model.access.csv',
'views/estate_property_offer_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_views.xml',
'views/estate_menu.xml'
]
}
4 changes: 4 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer
109 changes: 109 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
from odoo import fields, models, api


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Estate Property"

name = fields.Char('Title', required=True)
description = fields.Text('Description')
postcode = fields.Char('Postcode')
property_type_id = fields.Many2one(
'estate.property.type',
string='Property Type',
)
tag_ids = fields.Many2many(
comodel_name='estate.property.tag',
string='Tags',
)
date_availability = fields.Date(
string='Available From',
copy=False,
default=lambda self: fields.Date.add(
fields.Date.today(),
days=90,
),
)
expected_price = fields.Float(
string='Expected Price',
required=True,
)
selling_price = fields.Float(
string='Selling Price',
readonly=True,
copy=False,
)
bedrooms = fields.Integer('Bedrooms', default=2)
living_area = fields.Integer('Living Area (sqm)')
facades = fields.Integer('Number of Facades')
garage = fields.Boolean('is Garage')
garden = fields.Boolean('is Garden')
garden_area = fields.Integer('Garden Area')
garden_orientation = fields.Selection(
string='Garden Orientation',
selection=[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
],
)
active = fields.Boolean("Active", default=True)
state = fields.Selection(
string='State',
selection=[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("canceled", "Canceled")
],
default="new",
required=True,
copy=False,
)
buyer = fields.Many2one(
comodel_name='res.partner',
string='Buyer',
copy=False,
)
salesman = fields.Many2one(
comodel_name='res.users',
string='Salesman',
default=lambda self: self.env.user,
)
offer_ids = fields.One2many(
comodel_name='estate.property.offer',
inverse_name='property_id',
string='Offers',
)
total_area = fields.Integer(
string="Total area",
compute="_compute_total_area",
readonly=True,
)
best_price = fields.Float(
string='Best Offer',
compute="_compute_best_price",
readonly=True,
)

@api.depends("living_area", "garden_area")
def _compute_total_area(self):
for record in self:
record.total_area = record.living_area + record.garden_area

@api.depends("offer_ids")
def _compute_best_price(self):
for record in self:
record.best_price = max(record.offer_ids.mapped("price"))

@api.onchange("garden")
def _onchange_garden(self):
if self.garden:
self.garden_area = 10
self.garden_orientation = "north"
else:
self.garden_area = 0
self.garden_orientation = False

53 changes: 53 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from odoo import models, fields, api


class EstatePropertyOffer(models.Model):
_name = 'estate.property.offer'
_description = 'Estate Property Offer'

price = fields.Float(
string='Price',
)
status = fields.Selection(
selection=[
('accepted', 'Accepted'),
('refused', 'Refused')
],
copy=False,
string='Status',
)
partner_id = fields.Many2one(
comodel_name='res.partner',
required=True,
string='Partner',
)
property_id = fields.Many2one(
comodel_name='estate.property',
required=True,
string='Property',
)
validity = fields.Integer(
string='Validity',
default=7,
)
date_deadline = fields.Date(
string='Deadline',
compute='_compute_date_deadline',
inverse='_inverse_date_deadline',
)

@api.depends("validity")
def _compute_date_deadline(self):
for record in self:
create_date = record.create_date or fields.Date.today()
record.date_deadline = fields.Date.add(
create_date,
days=record.validity,
)

def _inverse_date_deadline(self):
for record in self:
create_date = record.create_date or fields.Date.today()
record.validity = (
record.date_deadline - fields.Date.to_date(create_date)
).days
8 changes: 8 additions & 0 deletions estate/models/estate_property_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyTag(models.Model):
_name = 'estate.property.tag'
_description = 'Estate Property Tag'

name = fields.Char(required=True)
8 changes: 8 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Estate Property Type"

name = fields.Char(required=True)
5 changes: 5 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tag, access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1
11 changes: 11 additions & 0 deletions estate/views/estate_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<odoo>
<menuitem id="real_estate_menu_root" name="Real Estate">
<menuitem id="advertisement_level_menu" name="Advertisements">
<menuitem id="properties_menu_action" action="real_estate_action"/>
</menuitem>
<menuitem id="property_type_menu" name="Settings">
<menuitem id="property_type_menu_action" name="Property Types" action="estate_action_property_type"/>
<menuitem id="property_tag_menu_action" name="Property Tags" action="estate_action_property_tag"/>
</menuitem>
</menuitem>
</odoo>
35 changes: 35 additions & 0 deletions estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<odoo>

<record id="estate_offer_form_view" model="ir.ui.view">
<field name="name">estate.offer.form</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="price"/>
<field name="partner_id"/>
<field name="validity"/>
<field name="date_deadline"/>
<field name="status"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_offer_list_view" model="ir.ui.view">
<field name="name">estate.offer.list</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<list>
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
<field name="validity"/>
<field name="date_deadline"/>
</list>
</field>
</record>

</odoo>
9 changes: 9 additions & 0 deletions estate/views/estate_property_tag_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<odoo>

<record id="estate_action_property_tag" model="ir.actions.act_window">
<field name="name">Property Tags</field>
<field name="res_model">estate.property.tag</field>
<field name="view_mode">list,form</field>
</record>

</odoo>
9 changes: 9 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<odoo>

<record id="estate_action_property_type" model="ir.actions.act_window">
<field name="name">Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>

</odoo>
94 changes: 94 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<odoo>

<record id="real_estate_action" model="ir.actions.act_window">
<field name="name">Properties</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

<record id="estate_list_view" model="ir.ui.view">
<field name="name">real.estate.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">

<list string="Propertiesss">
<field name="name"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability"/>
</list>

</field>
</record>

<record id="estate_form_view" model="ir.ui.view">
<field name="name">real.estate.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Propertiessss">
<sheet>
<group>
<h1><field name="name"/></h1>
<field name="tag_ids" widget="many2many_tags"/>
</group>
<group>
<group>
<field name="property_type_id"/>
<field name="postcode"/>
<field name="date_availability"/>
</group>
<group>
<field name="expected_price"/>
<field name="best_price"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<field name="garden_orientation"/>
<field name="total_area"/>
</group>
</page>
<page string="Offers">
<field name="offer_ids"/>
</page>
<page string="Other Info">
<group>
<field name="salesman"/>
<field name="buyer"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>

</record>

<record id="estate_search_view" model="ir.ui.view">
<field name="name">real.estate.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="">
<field name="name"></field>
<field name="postcode"></field>
<field name="expected_price"></field>
<field name="bedrooms"></field>
<field name="living_area"></field>
<field name="facades"></field>
</search>
</field>
</record>

</odoo>