diff --git a/.gitignore b/.gitignore
index b6e47617de1..1b77d315ad1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,4 @@ dmypy.json
# Pyre type checker
.pyre/
+.vscode/settings.json
diff --git a/estate/__init__.py b/estate/__init__.py
new file mode 100644
index 00000000000..0650744f6bc
--- /dev/null
+++ b/estate/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/estate/__manifest__.py b/estate/__manifest__.py
new file mode 100644
index 00000000000..6b174db81fc
--- /dev/null
+++ b/estate/__manifest__.py
@@ -0,0 +1,23 @@
+{
+ 'name': "Estate",
+ 'version': '1.0',
+ 'depends': ['base'],
+ 'author': "Asurk",
+ 'category': 'Real Estate/Brokerage',
+ 'description': """
+ A module so that customers can bid on real estates
+ """,
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/estate_property_views.xml',
+ 'views/estate_property_type_views.xml',
+ 'views/estate_property_tags_views.xml',
+ 'views/estate_property_offer_views.xml',
+ 'views/estate_menus.xml'
+ ],
+ 'license': 'LGPL-3', # Default License
+ 'application': True,
+ 'installable': True,
+ # data files always loaded at installation
+
+}
diff --git a/estate/models/__init__.py b/estate/models/__init__.py
new file mode 100644
index 00000000000..93a6bd86abd
--- /dev/null
+++ b/estate/models/__init__.py
@@ -0,0 +1 @@
+from . import estate_property, estate_property_type, estate_property_tag, estate_property_offer
diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py
new file mode 100644
index 00000000000..dd51f4394ae
--- /dev/null
+++ b/estate/models/estate_property.py
@@ -0,0 +1,100 @@
+from odoo import fields, models, api
+from odoo.exceptions import UserError, ValidationError
+
+
+class EstateProperty(models.Model):
+
+ _name = 'estate.property'
+ _description = "A real estate model with many fields"
+ active = fields.Boolean(string="Active", default="Active")
+ bedrooms = fields.Integer(string="Bedrooms", default="2")
+ best_price = fields.Float(
+ string="Best Price", compute='_compute_best_price')
+ buyer = fields.Many2one(
+ 'res.partner', string="Buyer", ondelete='restrict',
+ )
+ date_availability = fields.Datetime(
+ string="Available From", copy=False, default=lambda self: fields.Date.add(fields.Date.context_today(self), months=3))
+ description = fields.Text(string="Description")
+ expected_price = fields.Float(string="Expected Price", required=True)
+ facades = fields.Integer(string="Facades")
+ garden = fields.Boolean(string="Garden")
+ garden_area = fields.Float(string="Garden Area (sqm)")
+ garden_orientation = fields.Selection(
+ string="Direction",
+ selection=[
+ ('north', "North"),
+ ('south', "South"),
+ ('east', "East"),
+ ('west', "West")
+ ],
+ help="Type is used to specify the garden orientation"
+ )
+ garage = fields.Boolean(string="Garage")
+ living_area = fields.Float(string="Living Area (sqm)")
+ name = fields.Char(string="Title", required=True)
+ offer_ids = fields.One2many(
+ 'estate.property.offer', 'property_id', string='Offers')
+ postcode = fields.Char(string="Postcode")
+ property_type_id = fields.Many2one(
+ 'estate.property.type', string="Property Type")
+ salesman = fields.Many2one(
+ 'res.users', string="Salesman", ondelete='restrict',
+ )
+ selling_price = fields.Float(
+ string="Selling Price", readonly=True, copy=False)
+ state = fields.Selection([('new', "New"),
+ ('offer_received', "Offer Received"),
+ ('offer_accepted', "Offer Accepted"),
+ ('sold', "Sold"),
+ ('cancelled', "Cancelled")
+ ],
+ default='new')
+ tag_ids = fields.Many2many(
+ 'estate.property.tag',
+ string="Tags"
+ )
+ total_area = fields.Float(
+ string="Total Area", compute='_compute_total_area'
+ )
+
+ @api.depends('living_area', 'garden_area')
+ def _compute_total_area(self):
+ for rec in self:
+ rec.total_area = rec.living_area + rec.garden_area
+
+ @api.depends('offer_ids.price')
+ def _compute_best_price(self):
+ for rec in self:
+ rec.best_price = max(rec.mapped('offer_ids.price') or [0])
+
+ @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
+
+ @api.constrains('expected_price')
+ def _check_price(self):
+ for rec in self:
+ if rec.expected_price <= 0:
+ raise ValidationError("Price must be positive") # Shown in UI
+
+ def action_property_sold(self):
+ for rec in self:
+ if rec.state == 'cancelled':
+ raise UserError('A cancelled property cannot be sold')
+ else:
+ rec.state = 'sold'
+ return True
+
+ def action_property_cancelled(self):
+ for rec in self:
+ if rec.state == 'sold':
+ raise UserError('A sold property cannot be cancelled')
+ else:
+ rec.state = 'cancelled'
+ return True
diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py
new file mode 100644
index 00000000000..b92315f6845
--- /dev/null
+++ b/estate/models/estate_property_offer.py
@@ -0,0 +1,53 @@
+from odoo import api, fields, models
+from odoo.exceptions import UserError
+
+
+class EstatePropertyOffer(models.Model):
+
+ _name = 'estate.property.offer'
+ _description = "A model where offer for the properties are stored"
+
+ price = fields.Float(required=True)
+ status = fields.Selection(selection=[('accepted', "Accepted"),
+ ('refused', "Refused")])
+ partner_id = fields.Many2one('res.partner', required=True)
+ property_id = fields.Many2one(
+ 'estate.property', required=True)
+ validity = fields.Integer(string="Validity", default='7')
+ date_deadline = fields.Datetime(
+ string="Deadline", compute='_compute_date_deadline', inverse='_inverse_date_deadline')
+
+ @api.depends('validity', 'create_date')
+ def _compute_date_deadline(self):
+ for rec in self:
+ create_date = rec.create_date or fields.Date.context_today(self)
+ rec.date_deadline = fields.Date.add(create_date, days=rec.validity)
+
+ def _inverse_date_deadline(self):
+ for rec in self:
+ create_date = rec.create_date or fields.Date.context_today(self)
+ rec.validity = (rec.date_deadline - create_date).days
+
+ def action_status_accepted(self):
+ for rec in self:
+ if rec.status == 'accepted':
+ raise UserError("Offer has already been accepted")
+ rec.status = 'accepted'
+
+ rec.property_id.write({
+ 'buyer': rec.partner_id.id,
+ 'selling_price': rec.price,
+ })
+
+ return True
+
+ def action_status_refused(self):
+ for rec in self:
+ if rec.status == 'refused':
+ raise UserError("Offer has already been refused")
+ rec.status = 'refused'
+ rec.property_id.write({
+ 'buyer': False,
+ 'selling_price': False,
+ })
+ return True
diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py
new file mode 100644
index 00000000000..d08ca42c390
--- /dev/null
+++ b/estate/models/estate_property_tag.py
@@ -0,0 +1,10 @@
+from odoo import fields, models
+
+
+class EstatePropertyTag(models.Model):
+
+ _name = "estate.property.tag"
+ _description = "Tags for properties"
+
+ name = fields.Char(string="Tags")
+ color = fields.Integer(string="Color")
diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py
new file mode 100644
index 00000000000..b3887cd3d3a
--- /dev/null
+++ b/estate/models/estate_property_type.py
@@ -0,0 +1,11 @@
+from odoo import fields, models
+
+
+class EstatePropertyType(models.Model):
+
+ _name = 'estate.property.type'
+ _description = "A model where property types are defined"
+
+ name = fields.Char(required=True, string="Property Type")
+ property_ids = fields.One2many(
+ 'estate.property', inverse_name='property_type_id', string="Properties")
diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv
new file mode 100644
index 00000000000..0c0b62b7fee
--- /dev/null
+++ b/estate/security/ir.model.access.csv
@@ -0,0 +1,5 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
+estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1
+estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1
+estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1
diff --git a/estate/static/description/Real_Estate_Logo.jpg b/estate/static/description/Real_Estate_Logo.jpg
new file mode 100644
index 00000000000..1b99fe3f48d
Binary files /dev/null and b/estate/static/description/Real_Estate_Logo.jpg differ
diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml
new file mode 100644
index 00000000000..c54646f5b05
--- /dev/null
+++ b/estate/views/estate_menus.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/estate/views/estate_property_offer_views.xml b/estate/views/estate_property_offer_views.xml
new file mode 100644
index 00000000000..c2579148bf7
--- /dev/null
+++ b/estate/views/estate_property_offer_views.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ Property Offers
+ estate.property.offer
+ list,form
+
+
+
+
+
+ estate.property.offer.list
+ estate.property.offer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.offer.form
+ estate.property.offer
+
+
+
+
+
+
diff --git a/estate/views/estate_property_tags_views.xml b/estate/views/estate_property_tags_views.xml
new file mode 100644
index 00000000000..fa995234a6d
--- /dev/null
+++ b/estate/views/estate_property_tags_views.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+ Property Types
+ estate.property.tag
+ list,form
+
+
+
+
+
+
+ estate.property.tag.list
+ estate.property.tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.tag.form
+ estate.property.tag
+
+
+
+
+
+
+
+
+
diff --git a/estate/views/estate_property_type_views.xml b/estate/views/estate_property_type_views.xml
new file mode 100644
index 00000000000..22bfbb87028
--- /dev/null
+++ b/estate/views/estate_property_type_views.xml
@@ -0,0 +1,28 @@
+
+
+
+
+ Property Types
+ estate.property.type
+ list,form
+
+
+
+ estate.property.type.form
+ estate.property.type
+
+
+
+
+
+
+
diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml
new file mode 100644
index 00000000000..fb9f78d62f4
--- /dev/null
+++ b/estate/views/estate_property_views.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+ Property Action
+ estate.property
+ list,form
+
+ {'search_default_available_properties':1}
+
+
+
+
+
+ estate.property.list
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.form
+ estate.property
+
+
+
+
+
+
+
+
+
+ real.estate.search
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+