Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"
}
4 changes: 1 addition & 3 deletions product_currency/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"product",
],
"depends": ["product"],
"data": [
"views/product_template_views.xml",
"security/product_currency_security.xml",
Expand Down
3 changes: 3 additions & 0 deletions real_estate/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"
}
1 change: 1 addition & 0 deletions real_estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
41 changes: 41 additions & 0 deletions real_estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Real Estate Management",
"version": "18.0.1.0.0",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"depends": [
"sale_management",
],
"data": [
"security/ir.model.access.csv",
"views/estate_property_views.xml",
"views/estate_property_types_views.xml",
"views/estate_property_tags_views.xml",
"views/estate_property_offer_views.xml",
"views/estate_menus.xml",
],
"demo": [],
"installable": True,
"auto_install": False,
"application": True,
}
4 changes: 4 additions & 0 deletions real_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_tags
from . import estate_property_offer
63 changes: 63 additions & 0 deletions real_estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from odoo import api, fields, models


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Real Estate Properties"
name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False, default=lambda self: fields.Date.add(fields.Date.today(), months=3))
expected_price = fields.Float(required=True)
selling_price = fields.Float(readonly=True, copy=False)
bedrooms = fields.Integer(default=2)
living_area = fields.Integer()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
# garden_area = fields.Boolean()
garden_area_new = fields.Float(string="Garden Area")
active = fields.Boolean(default=True)
garden_orientation = fields.Selection(
[("north", "North"), ("south", "South"), ("east", "East"), ("west", "West")],
)
state = fields.Selection(
[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("canceled", "Canceled"),
],
required=True,
copy=False,
default="new",
)

property_type_id = fields.Many2one("estate.property.type", string="Property Type")
sales_man = fields.Many2one("res.partner", string="Sales man", default=lambda self: self.env.user)
buyer = fields.Many2one("res.partner", string="Buyer")
tags_id = fields.Many2many("estate.property.tags", string="Tags")
offer_ids = fields.One2many("estate.property.offer", "property_id")
total_area = fields.Float(compute="_compute_total_area")
best_price = fields.Float(compute="_compute_best_price")

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

@api.depends("offer_ids.price")
def _compute_best_price(self):
for rec in self:
prices = rec.offer_ids.mapped("price")
rec.best_price = max(prices) if prices else 0

@api.onchange("garden")
def _onchange_garden(self):
if self.garden:
self.garden_area_new = 10
self.garden_orientation = "north"
else:
self.garden_area_new = 0
self.garden_orientation = 0
28 changes: 28 additions & 0 deletions real_estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from odoo import api, fields, models


class EstatePropertyOffer(models.Model):
_name = "estate.property.offer"
_description = "Estate Property Offer"
name = fields.Char(required=True)
price = fields.Float()
status = fields.Selection(
[
("accepted", "Accepted"),
("refused", "Refused"),
],
copy=False,
)
partner_id = fields.Many2one("res.partner", string="Socio ID", required=True)
property_id = fields.Many2one("estate.property", string="Property ID", required=True)
validity = fields.Integer(default=7)
date_deadline = fields.Date(compute="_compute_date_deadline", inverse="_inverse_date_deadline")

@api.depends("create_date", "validity")
def _compute_date_deadline(self):
for rec in self:
rec.date_deadline = fields.Date.add(rec.date_deadline, days=rec.validity) if rec.create_date else False

def _inverse_date_deadline(self):
for rec in self:
rec.validity = (rec.date_deadline - rec.create_date()).days
7 changes: 7 additions & 0 deletions real_estate/models/estate_property_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class EstatePropertyTags(models.Model):
_name = "estate.property.tags"
_description = "Estate Property Tags"
name = fields.Char(required=True)
7 changes: 7 additions & 0 deletions real_estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Estate Property Types"
name = fields.Char(required=True)
5 changes: 5 additions & 0 deletions real_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
real_estate.access_estate_property,access_estate_property,real_estate.model_estate_property,base.group_user,1,1,1,1
real_estate.access_estate_property_type,access_estate_property_type,real_estate.model_estate_property_type,base.group_user,1,1,1,1
real_estate.access_estate_property_tags,access_estate_property_tags,real_estate.model_estate_property_tags,base.group_user,1,1,1,1
real_estate.access_estate_property_offer,access_estate_property_offer,real_estate.model_estate_property_offer,base.group_user,1,1,1,1
8 changes: 8 additions & 0 deletions real_estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo>
<menuitem id="real_estate_menu" name="Real Estate"/>
<menuitem id="advertisements_menu" name="Advertisements" parent="real_estate_menu"/>
<menuitem id="properties_menu" action="estate_property_action" parent="advertisements_menu"/>
<menuitem id="settings_menu" name="Settings" sequence="100" parent="real_estate_menu"/>
<menuitem id="property_type_menu" action="estate_property_type_action" parent="settings_menu"/>
<menuitem id="property_tags_menu" action="estate_property_tags_action" parent="settings_menu"/>
</odoo>
34 changes: 34 additions & 0 deletions real_estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<odoo>
<record id="estate_property__offer_view_list" model="ir.ui.view">
<field name="name">estate_property_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>

<record id="estate_property__offer_view_form" model="ir.ui.view">
<field name="name">estate_property_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="status"/>
<field name="validity"/>
<field name="date_deadline"/>
</group>
</sheet>
</form>
</field>
</record>

</odoo>
41 changes: 41 additions & 0 deletions real_estate/views/estate_property_tags_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<odoo>
<record id="estate_property_tags_action" model="ir.actions.act_window">
<field name="name">Tags</field>
<field name="res_model">estate.property.tags</field>
</record>

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

<record id="estate_property__tags_view_form" model="ir.ui.view">
<field name="name">estate_property_tags.form</field>
<field name="model">estate.property.tags</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name" class="mb16" placeholder="Title"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_tags_view_search" model="ir.ui.view">
<field name="name">estate_property_tags.search</field>
<field name="model">estate.property.tags</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
</search>
</field>
</record>
</odoo>

42 changes: 42 additions & 0 deletions real_estate/views/estate_property_types_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<odoo>
<record id="estate_property_type_action" model="ir.actions.act_window">
<field name="name">Properties Types</field>
<field name="res_model">estate.property.type</field>
</record>

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

<record id="estate_property__type_view_form" model="ir.ui.view">
<field name="name">estate_property_type.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name" class="mb16" placeholder="Title"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_type_view_search" model="ir.ui.view">
<field name="name">estate_property_type.search</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
</search>
</field>
</record>
</odoo>


Loading
Loading