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..d7311af8edf --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,20 @@ +{ + '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_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..5e1963c9d2f --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1 @@ +from . import estate_property diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..25c994eeeed --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,46 @@ +from odoo import fields, models, api +from odoo.exceptions import 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") + 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.Integer(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.Integer(string="Living Area (sqm)") + name = fields.Char(string="Title", required=True, default="Unknown") + postcode = fields.Integer(string="Postcode") + 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') + + @api.constrains('expected_price') + def _check_price(self): + for rec in self: + if rec.expected_price <= 0: + raise ValidationError("Price must be positive") diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..98f4671fb0d --- /dev/null +++ b/estate/security/ir.model.access.csv @@ -0,0 +1,2 @@ +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 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..9fc7f95ac09 --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..9489826ee00 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,10 @@ + + + + + Property Action + estate.property + list,form + + +