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..2391f4c9bf7 --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,17 @@ +{ + 'name': "Real Estate", + 'version': '1.0', + 'license': 'LGPL-3', + 'summary': 'Real Estate advertisement tutorial module', + 'depends': ['base'], + 'author': "Harsh Maniya", + 'data': [ + 'security/ir.model.access.csv', + 'views/estate_property_views.xml', + 'views/estate_menus.xml', + ], + 'category': 'Sales/Real Estate', + 'installable': True, + 'auto_install': False, + 'description': """Description text""", +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..9d5e62fe812 --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1 @@ +from . import estate_property # noqa: F401 diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..35009ccabc6 --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,53 @@ +from odoo import models, fields +from dateutil.relativedelta import relativedelta +from datetime import date + + +class EstateProperty(models.Model): + _name = "estate.property" + _description = "Real Estate Property" + + name = fields.Char(string="Property Title", required=True) + description = fields.Text(string="Description") + postcode = fields.Char(string="Postcode") + date_availability = fields.Date( + string="Available From", + default=lambda sself: date.today() + relativedelta(months=3), + copy=False + ) + expected_price = fields.Float(string="Expected Price", required=True) + selling_price = fields.Float( + string="Selling Price", + readonly=True, + copy=False + ) + + bedrooms = fields.Integer(string="Bedrooms", default=2) + living_area = fields.Integer(string="Living Area (sqm)") + facades = fields.Integer(string="Number of Facades") + garage = fields.Boolean(string="Has Garage") + garden = fields.Boolean(string="Has Garden") + garden_area = fields.Integer(string="Garden Area (sqm)") + garden_orientation = fields.Selection( + selection=[ + ('north', 'North'), + ('south', 'South'), + ('east', 'East'), + ('west', 'West'), + ], + string="Garden Orientation" + ) + active = fields.Boolean(default=True) + state = fields.Selection( + selection=[ + ('new', 'New'), + ('offer_received', 'Offer Received'), + ('offer_accepted', 'Offer Accepted'), + ('sold', 'Sold'), + ('cancelled', 'Cancelled'), + ], + string="Status", + required=True, + copy=False, + default='new', +) diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..a6992df6d34 --- /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 +access_estate_property_user,access_estate_property_user,model_estate_property,base.group_user,1,1,1,1 diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml new file mode 100644 index 00000000000..7154c53b30f --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..62a46c36e54 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,25 @@ + + + + + Properties + estate.property + list,form + + + + + estate.property.list + estate.property + + + + + + + + + + + +